[issue41549] IDLE leaks `_` into hint box

2020-08-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think that I understood what is the issue.

1. Open the IDLE editor, type "foo" and press . The pop-up list 
does not contain "foo".
2. Switch to the IDLE shell, type "foo = 1" and press .
3. Switch back to the IDLE editor (the cursor points after "foo") and press 
 again. The pop-up list contains now "foo".

The problem is that the completion list for editor contains names from the 
shell instead of only from builtins. When you run the code from the editor, 
names from the shell are not automatically available.

It can be a feature if you use the same star-import in the shell and editor, 
but it can also be considered as a bug.

--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41549>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41547] Expose default __getstate__ and __setstate__

2020-08-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This is virtually a duplicate of isssue26579.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Support pickling slots in subclasses of common classes

___
Python tracker 
<https://bugs.python.org/issue41547>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40782] AbstactEventLoop.run_in_executor is listed as an async method, but should actually return a Future

2020-08-13 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
title: AbstactEventLoop.run_in_executor is listed as an async method, but 
should actually return a Futrue -> AbstactEventLoop.run_in_executor is listed 
as an async method, but should actually return a Future

___
Python tracker 
<https://bugs.python.org/issue40782>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39994] Redundant code in pprint module.

2020-08-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

bpo-23741 did not change the behavior. The specified code was added specially 
to preserve the existing behavior. For other base types the condition was like 
`issubclass(typ, list) and r is list.__repr__`, but for dict it was just 
`issubclass(typ, dict)`.

Actually the initial behavior was changed by 
bad3c88094f43f3bc7dcce22f47b8c2a8dddabcf (no issue number), with adding support 
of OrderedDict.

--
nosy: +rhettinger

___
Python tracker 
<https://bugs.python.org/issue39994>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39994] Redundant code in pprint module.

2020-08-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, this code was kept for backward compatibility when the dispatch mapping 
was added.

--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue39994>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41532] Import precedence is broken in some library

2020-08-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is because module functools is already imported (you can see it in 
sys.modules), but module tokenize is not. It is likely due to module 
rlcompleter imported at startup on Linux, but not on Windows.

--
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41532>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41531] Python 3.9 regression: Literal dict with > 65535 items are one item shorter

2020-08-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Interpreter Core
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41531>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41527] smart quotes in Lib/pydoc_data/topics.py file

2020-08-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Pydoc uses the backslashreplace error handler for characters not encodable with 
the output encoding (see issue21398 and issue23374).

$ LC_ALL=uk_UA.koi8-u ./python -c "help('async')"
[...]

[2] A string literal appearing as the first statement in the
function body is transformed into the function\u2019s "__doc__"
attribute and therefore the function\u2019s *docstring*.

[3] A string literal appearing as the first statement in the class
body is transformed into the namespace\u2019s "__doc__" item and
therefore the class\u2019s *docstring*.


It would be better to replace non-ASCII quotation marks and dashes with 
corresponding ASCII quotation marks and hyphen-minus if they cannot be encoded. 
It may be a part of more general feature for transliterating non-ASCII 
characters to ASCII.

--

___
Python tracker 
<https://bugs.python.org/issue41527>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41525] Python '--help' has corrupted text.

2020-08-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, but I think it is worth opening a separate issue.

--

___
Python tracker 
<https://bugs.python.org/issue41525>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41521] Replace whitelist/blacklist with allowlist/denylist

2020-08-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Should not such changes be widely discussed on the Python-Dev mailing list 
before merging?

--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41521>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41524] PyOS_mystricmp advances pointers too far

2020-08-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Good catch! Do you mind to provide a PR for this William?

--
keywords: +easy (C)
nosy: +serhiy.storchaka
stage:  -> needs patch

___
Python tracker 
<https://bugs.python.org/issue41524>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41525] Python '--help' has corrupted text.

2020-08-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
nosy: +serhiy.storchaka
nosy_count: 2.0 -> 3.0
pull_requests: +20964
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21836

___
Python tracker 
<https://bugs.python.org/issue41525>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41523] functools.cached_property does not satisfy the property check

2020-08-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There are not much things common to property and cached_property. 
cached_property does not have attributes fget, fset, fdel. They are both 
descriptors, but cached_property is not a data descriptor.

--

___
Python tracker 
<https://bugs.python.org/issue41523>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41523] functools.cached_property does not satisfy the property check

2020-08-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

No, cached_property is a completely different class.

--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41523>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40185] Refactor typing.NamedTuple

2020-08-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

$ echo 'from typing import NamedTuple; NamedTuple("A")' | ./python -m ast
Module(
   body=[
  ImportFrom(
 module='typing',
 names=[
alias(name='NamedTuple')],
 level=0),
  Expr(
 value=Call(
func=Name(id='NamedTuple', ctx=Load()),
args=[
   Constant(value='A')],
keywords=[]))],
   type_ignores=[])

So mod.body[-1].value is a call:

Call(func=Name(id='NamedTuple', ctx=Load()), args=[Constant(value='A')], 
keywords=[])

I do not know what Astroid does with this node, but seem the problem is in its 
infer() method.

--

___
Python tracker 
<https://bugs.python.org/issue40185>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41419] Path.mkdir and os.mkdir don't respect setgid if its parent is g-s

2020-08-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

os.mkdir() is a thin wrapper around syscalls mkdir or mkdirat. Path.mkdir() is 
a thin wrapper around os.mkdir(). If you think that the behavior of mkdir 
differs from the documentation please file a report in the Linux kernel.

--
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41419>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41497] Potential UnicodeDecodeError in dis

2020-08-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Good catch. Yes, when read Python source files you should either open them in 
binary mode if reading bytes is enough for use, or open them with 
tokenize.open() if we need string data, or use token.detect_encoding() and pass 
the result to open().

--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41497>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41435] Allow to retrieve ongoing exception handled by every threads

2020-08-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Would not be more useful to add a method to the Thread or frame object to 
obtain the topmost handled exception? Then you could iterate all threads or 
frames and obtain exceptions together with other useful information.

Note also that it omits exceptions in generators and coroutines.

--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41435>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41457] Implement random.shuffled

2020-08-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This is a duplicate of issue26393 and issue27964.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> random.shuffled

___
Python tracker 
<https://bugs.python.org/issue41457>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41421] Random.paretovariate sometimes raises ZeroDivisionError for small alpha

2020-07-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

+1 for "u ** (-1.0 / alpha)"!

--

___
Python tracker 
<https://bugs.python.org/issue41421>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41431] Optimize dict_merge for copy

2020-07-28 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka, yselivanov

___
Python tracker 
<https://bugs.python.org/issue41431>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41422] C Unpickler memory leak via memo

2020-07-28 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41422>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41421] Random.paretovariate sometimes raises ZeroDivisionError for small alpha

2020-07-28 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41421>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41417] SyntaxError: assignment expression within assert

2020-07-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is a duplicate of issue39909.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Assignment expression in assert causes SyntaxError

___
Python tracker 
<https://bugs.python.org/issue41417>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41395] pickle and pickletools cli interface doesn't close input and output file.

2020-07-28 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +easy

___
Python tracker 
<https://bugs.python.org/issue41395>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41409] deque.pop(index) is not supported

2020-07-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

If deque does not fully support the MutableSequence interface, should not it be 
un-regitered as MutableSequence? Maybe we need other abstract class which would 
be parent of MutableSequence and deque?

--
nosy: +stutzbach

___
Python tracker 
<https://bugs.python.org/issue41409>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40841] Provide mimetypes.sniff API as stdlib

2020-07-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think that both functions for detecting file type, by name and by content, 
are useful in different circumstances. We have similar more specific detection 
functions sndhdr and imghdr.

But I am not sure whether it should be a part of the mimetypes module or 
separate module. Should it use sndhdr and imghdr modules for audio and image 
types? Should it be a wrapper to the libmagic library 
(https://linux.die.net/man/3/libmagic) or reimplement it in Python?

If we add the code for detecting the file type based on algorithms used in 
browsers, should not we add also the code for detecting the text encoding based 
on other algorithms used in browsers, or it is too much?

--

___
Python tracker 
<https://bugs.python.org/issue40841>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41416] Restore default implementation of __ne__ in mixins Set and Mapping

2020-07-28 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

According to the documentation [1] abstract classes collections.abc.Set and 
collections.abc.Mapping provide mixin method __ne__. But implementations of 
__ne__ in these classes were removed in 3.4 (see issue21408), so the default 
implementation is inherited from object. The reason is that it works better 
with classes which override __ne__ to return non-boolean, e.g. NumPy, SymPy and 
sqlalchemy classes. Previously the != operator falled back to other__eq__(), 
now it falls back to other__ne__().

[1] 
https://docs.python.org/3/library/collections.abc.html#collections-abstract-base-classes

But now we have a discrepancy between the decomentation and the code. According 
to the documentation, if we have a class which inherits from both Set and int, 
in that order, the __ne__ method should be inherited from class Set instead of 
class int. But currently it is inherited from int.

>>> import collections.abc
>>> class A(collections.abc.Set, int): pass
... 
>>> A.__ne__


One way to solve this -- remove __ne__ from lists of mixin methods (see 
issue41400). Other way -- add the __ne__ implementations which are identical to 
the default implementation but has preference in the inheritance. I prefer the 
latter.

--
components: Library (Lib)
messages: 374470
nosy: rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Restore default implementation of __ne__ in mixins Set and Mapping
type: behavior
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue41416>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41416] Restore default implementation of __ne__ in mixins Set and Mapping

2020-07-28 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +20795
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21628

___
Python tracker 
<https://bugs.python.org/issue41416>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41416] Restore default implementation of __ne__ in mixins Set and Mapping

2020-07-28 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests:  -20795

___
Python tracker 
<https://bugs.python.org/issue41416>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41401] Using non-ascii that require UTF-8 breaks AIX testing

2020-07-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Automatic backport does not work due to changes in the test.support module. 
Victor, do you mind to backport PR 21640 to 3.9 and 3.8?

--
nosy: +vstinner

___
Python tracker 
<https://bugs.python.org/issue41401>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41401] Using non-ascii that require UTF-8 breaks AIX testing

2020-07-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 67987acd5dc9776f55f4e139e2b3d9e7a6434d9f by Serhiy Storchaka in 
branch 'master':
bpo-41401: Fix test_fspath_support in test_io. (GH-21640)
https://github.com/python/cpython/commit/67987acd5dc9776f55f4e139e2b3d9e7a6434d9f


--

___
Python tracker 
<https://bugs.python.org/issue41401>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41409] deque.pop(index) is not supported

2020-07-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

>>> issubclass(collections.deque, collections.abc.MutableSequence)
True
>>> sorted(set(dir(collections.abc.MutableSequence)) - 
>>> set(dir(collections.deque)))
['__abstractmethods__', '__module__', '__slots__', '_abc_impl']

Well, it is a bug.

--
type:  -> behavior

___
Python tracker 
<https://bugs.python.org/issue41409>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41409] deque.pop(index) is not supported

2020-07-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

deque is not a subclass of MutableMapping, so the Liskov substitution principle 
is not related here.

deque is not registered as a virtual subclass of MutableMapping and it lacks a 
number of MutableMapping methods.

>>> import collections.abc
>>> issubclass(collections.deque, collections.abc.MutableMapping)
False
>>> sorted(set(dir(collections.abc.MutableMapping)) - 
>>> set(dir(collections.deque)))
['_MutableMapping__marker', '__abstractmethods__', '__module__', '__slots__', 
'_abc_impl', 'get', 'items', 'keys', 'popitem', 'setdefault', 'update', 
'values']

--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41409>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41401] Using non-ascii that require UTF-8 breaks AIX testing

2020-07-27 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +20781
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21640

___
Python tracker 
<https://bugs.python.org/issue41401>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41401] Using non-ascii that require UTF-8 breaks AIX testing

2020-07-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There are two errors in test_io, both are not related to AIX.

The first one is in test_fspath_support. It is exposed on non-UTF-8 locales. 
AIX by accident use ISO8859-1 locale by default.

The second one is in test_reader_writer_close_error_on_close and related to 
garbage collector. Seems it is only exposed when run this test separately.

--

___
Python tracker 
<https://bugs.python.org/issue41401>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41397] Restore default implementation of __ne__ in Counter

2020-07-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The current code returns NotImplemented for non-Counter. If we want to 
implement equality comparison with other class we have to override __ne__.

--

___
Python tracker 
<https://bugs.python.org/issue41397>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41400] Remove references to nonexisting __ne__ methods

2020-07-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Is it good to provide incorrect information in the documentation? It is a 
matter of correctness, not style.

--

___
Python tracker 
<https://bugs.python.org/issue41400>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18280] Documentation is too personalized

2020-07-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think they are not required, but recommended.

>From https://www.python.org/dev/peps/pep-0008/#comments:

   You should use two spaces after a sentence-ending period in multi- sentence 
comments, except after the final sentence.

>From https://www.python.org/dev/peps/pep-0012/#general:

   You must adhere to the Emacs convention of adding two spaces at the end of 
every sentence.

AFAIK in English typography the space after a sentence-ending period is longer 
than spaces between words. In other European typographies they have the same 
width.

--

___
Python tracker 
<https://bugs.python.org/issue18280>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41401] Using non-ascii that require UTF-8 breaks AIX testing

2020-07-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you for your report (and for all other heroic work for maintaining AIX). 
Breaking only one test on AIX looks like a good news.

Do you able to run tests manually? Could you please run the following command?

./python -m test --list-cases -uall test_io | xargs -n 1 ./python -m test 
-vuall test_io -m

It may help to determine what exactly the test was broken.

--

___
Python tracker 
<https://bugs.python.org/issue41401>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41288] Pickle crashes unpickling invalid NEWOBJ_EX opcode

2020-07-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I do not think it is a security issue. The crash cannot be triggered by the 
user input unless you accept the pickle data from untrusted sources, but in 
that case you are in large danger, because you allow executing arbitrary code.

The changes in this issue just help to debug in some cases when you play with 
pickle format. In any case thank you for your report.

--
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41288>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41399] Add stacklevel support for exceptions

2020-07-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

warnings.warn(), the function which emits warnings, has the stacklevel 
parameter. But how do you provide stacklevel for exceptions?

See also bpo-39725.

--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41399>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41400] Remove references to nonexisting __ne__ methods

2020-07-26 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +20769
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21628

___
Python tracker 
<https://bugs.python.org/issue41400>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41400] Remove references to nonexisting __ne__ methods

2020-07-26 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

There is the documentation for method __ne__ implementations in classes Set, 
Mapping, Header, Charset, Binary, but all these implementations are removed now 
and the default implementation of object.__ne__ is used instead.

--
assignee: docs@python
components: Documentation
messages: 374309
nosy: barry, docs@python, maxking, r.david.murray, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Remove references to nonexisting __ne__ methods
type: enhancement
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue41400>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41397] Restore default implementation of __ne__ in Counter

2020-07-26 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +20768
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21627

___
Python tracker 
<https://bugs.python.org/issue41397>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41397] Restore default implementation of __ne__ in Counter

2020-07-26 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Currently collections.Counter implements both __eq__ and __ne__ methods. The 
problem is that if you subclass Counter and override its __eq__ method you will 
need to implement also the __ne__ method. Usually you do not need to implement 
__ne__ because the implementation inherited from the object class does the 
right thing in most cases (unless you implement NumPy or symbolic expressions). 
Also, the Python implementation of Counter.__ne__ is a tiny bit slower than the 
C implementation of object.__ne__.

Counter.__ne__ was added because the implementation of __ne__ inherited from 
dict did not work correct for Counter. But we can just restore the default 
implementation:

__ne__ = object.__ne__

Of all Python classes in the stdlib which implement __eq__ only Counter, 
WeakRef and some mock classes implement also __ne__. In case of Counter I think 
it is not necessary.

--
components: Library (Lib)
messages: 374306
nosy: rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Restore default implementation of __ne__ in Counter
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue41397>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41373] IDLE: edit/save files created by Windows Explorer

2020-07-26 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41373>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41385] test_executable_without_cwd fails on appx test run in Azure pipelines

2020-07-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset b1a87300a06324c9fc7d6553906ed914489465aa by Serhiy Storchaka in 
branch 'master':
bpo-41385: Fix test_executable_without_cwd on Windows (GH-21608)
https://github.com/python/cpython/commit/b1a87300a06324c9fc7d6553906ed914489465aa


--

___
Python tracker 
<https://bugs.python.org/issue41385>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41395] pickle and pickletools cli interface doesn't close input and output file.

2020-07-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41395>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41393] Fix FAQ example to use __import__('functools').reduce

2020-07-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41393>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41385] test_executable_without_cwd fails on appx test run in Azure pipelines

2020-07-24 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
nosy: +serhiy.storchaka
nosy_count: 5.0 -> 6.0
pull_requests: +20750
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21608

___
Python tracker 
<https://bugs.python.org/issue41385>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41280] lru_cache on 0-arity functions should default to maxsize=None

2020-07-24 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests:  -20743

___
Python tracker 
<https://bugs.python.org/issue41280>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41378] IDLE EOL convention not set on a empty file

2020-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is a duplicate of issue41373 (and the problem is not only with empty files).

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> IDLE: edit/save files created by Windows Explorer

___
Python tracker 
<https://bugs.python.org/issue41378>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41377] memoryview of str (unicode)

2020-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I concur with Raymond.

Also, it could not help to caught bugs when you get a string instead expected 
bytes object. It may "work" in tests while string is ASCII, but fail miserably 
on real-world non-ASCII data.

--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41377>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41375] `mode` security concern

2020-07-23 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> not a bug

___
Python tracker 
<https://bugs.python.org/issue41375>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41375] `mode` security concern

2020-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is expected behavior on Posix system. See 
https://pubs.opengroup.org/onlinepubs/9699919799/functions/umask.html

What is the problem?

--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41375>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37095] [Feature Request]: Add zstd support in tarfile

2020-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The tarfile module supports arbitrary compressions by using the stream mode. 
You only need to use a third-party library which provides zstd support.

Recent versions of the tar utility has options to explicit support of new 
compressions: --lzip, --lzma, --lzop, --zstd, so corresponding modes can be 
added to the tarfile module. But it needs to include the support of these 
compressions in the stdlib. It should be discussed on the Python-ideas mailing 
list.

https://mail.python.org/mailman3/lists/python-ideas.python.org/

--

___
Python tracker 
<https://bugs.python.org/issue37095>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41373] IDLE: edit/save files created by Windows Explorer

2020-07-23 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +20736
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/21597

___
Python tracker 
<https://bugs.python.org/issue41373>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41373] IDLE: edit/save files created by Windows Explorer

2020-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I missed that the file's attribute newlines can be None if no line separators 
were read. It can also be a tuple if mixed newlines are used. I think that 
eol_convention should be set to the default value os.linesep in these cases.

I am currently not able to test this since IDLE does not work on my computer 
after upgrading to Ubuntu 20.04.

--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41373>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41288] Pickle crashes unpickling invalid NEWOBJ_EX opcode

2020-07-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This fix touched the unpickling code, and the test crashed during pickling, so 
it is not directly related. But it may be some compiler glitch, when changing 
one part of code affects compilation of other parts of code. The next run on 
the buildbot was passed, and there were failures in the past (but logs were not 
saved), so it may be just unstable test.

--

___
Python tracker 
<https://bugs.python.org/issue41288>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41361] Converting collections.deque methods to Argument Clinic

2020-07-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Now Argument Clinic generates more efficient (but more cumbersome) code, so 
there may be new reasons of using it. Please test the performance of the deque 
constructor (deque(), deque(()), deque((), 10), deque((), maxlen=10)), methods 
index() and rotate(), builtins iter() and reversed(). It is hard to test 
insert() because it mutates the deque and I do not expect anything beside noise 
for other methods.

--

___
Python tracker 
<https://bugs.python.org/issue41361>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41288] Pickle crashes unpickling invalid NEWOBJ_EX opcode

2020-07-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
status: closed -> open

___
Python tracker 
<https://bugs.python.org/issue41288>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41361] Converting collections.deque methods to Argument Clinic

2020-07-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See also issue20180. collections.deque was intentionally not converted to 
Argument Clinic, but some of methods were made using more efficient code for 
parsing arguments by inlining the code generated by Argument Clinic at that 
time.

--
nosy: +rhettinger, serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41361>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41334] Convert str(), bytes() and bytearray() to Argument Clinic

2020-07-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41334>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41342] Convert int.__round__ to Argument Clinic

2020-07-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41342>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41343] Convert complex methods to Argument Clinic

2020-07-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41343>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41342] Convert int.__round__ to Argument Clinic

2020-07-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 5a2bac7fe0e7a2b67fd57c7a9176a50feed0d7a0 by Serhiy Storchaka in 
branch 'master':
bpo-41342: Convert int.__round__ to Argument Clinic (GH-21549)
https://github.com/python/cpython/commit/5a2bac7fe0e7a2b67fd57c7a9176a50feed0d7a0


--

___
Python tracker 
<https://bugs.python.org/issue41342>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41343] Convert complex methods to Argument Clinic

2020-07-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset e123012d79121ab543583631bb84c7fc27d06338 by Dong-hee Na in branch 
'master':
bpo-41343: Convert methods of complex to Argument Clinic (GH-21550)
https://github.com/python/cpython/commit/e123012d79121ab543583631bb84c7fc27d06338


--

___
Python tracker 
<https://bugs.python.org/issue41343>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41336] Sporadic segfaults during zoneinfo object creation stopped using Ctrl-C

2020-07-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset eca2549f5a5048b44ca88b9555f1c62f094e3c12 by Zackery Spytz in 
branch 'master':
bpo-41336: Fix the error handling in zoneinfo_new_instance() (GH-21546)
https://github.com/python/cpython/commit/eca2549f5a5048b44ca88b9555f1c62f094e3c12


--

___
Python tracker 
<https://bugs.python.org/issue41336>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41334] Convert str(), bytes() and bytearray() to Argument Clinic

2020-07-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 12f433411bba8a0cdc4f09ba34472745ae9da0d1 by Serhiy Storchaka in 
branch 'master':
bpo-41334: Convert constructors of str, bytes and bytearray to Argument Clinic 
(GH-21535)
https://github.com/python/cpython/commit/12f433411bba8a0cdc4f09ba34472745ae9da0d1


--

___
Python tracker 
<https://bugs.python.org/issue41334>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41342] Convert int.__round__ to Argument Clinic

2020-07-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, you can do this without Argument Clinic, but Argument Clinic allows to 
hide the use of unstable private API and cumbersome code under macros and in 
generated files.

> That said, it would be great if someone were to work on building-out AC to 
> support more interesting argument patterns like those in round().

The problem is not only in Argument Clinic (and the Argument Clinic part is 
mainly solved). The problem is that currently it is not possible to express the 
signature of int.__round__() (and dict.get(), and getattr()) in Python syntax, 
and the inspect module does not support any non-Python syntax for this either. 
Once we invent the way to express it, supporting it in Argument Clinic will be 
merely technical problem.

--

___
Python tracker 
<https://bugs.python.org/issue41342>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41343] Convert complex methods to Argument Clinic

2020-07-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I wrote similar patch for __format__ and got similar tiny speed up. It is 
expectable. But I am surprised that you get a difference for conjugate() and 
__getnewargs__. It may be a compiler artifact.

In any case the benefit of converting to Argument Clinic in this case is adding 
signatures for these methods.

--
nosy: +mark.dickinson, serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41343>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41342] Convert int.__round__ to Argument Clinic

2020-07-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +20691
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21549

___
Python tracker 
<https://bugs.python.org/issue41342>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41342] Convert int.__round__ to Argument Clinic

2020-07-19 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

int.__round__ was not converted to Argument Clinic because it is not impossible 
to express a correct signature for it in Python. But now we can at least make 
Argument Clinic not producing incorrect signature. And converting to Argument 
Clinic has a performance benefit.

$ ./python -m pyperf timeit -q --compare-to=../cpython-baseline/python 
"round(12345)"
Mean +- std dev: [/home/serhiy/py/cpython-baseline/python] 123 ns +- 6 ns -> 
[/home/serhiy/py/cpython-release/python] 94.4 ns +- 2.4 ns: 1.31x faster (-23%)

$ ./python -m pyperf timeit -q --compare-to=../cpython-baseline/python 
"round(12345, 0)"
Mean +- std dev: [/home/serhiy/py/cpython-baseline/python] 159 ns +- 4 ns -> 
[/home/serhiy/py/cpython-release/python] 98.6 ns +- 2.4 ns: 1.61x faster (-38%)

$ ./python -m pyperf timeit -q --compare-to=../cpython-baseline/python 
"round(12345, -2)"
Mean +- std dev: [/home/serhiy/py/cpython-baseline/python] 585 ns +- 9 ns -> 
[/home/serhiy/py/cpython-release/python] 534 ns +- 14 ns: 1.09x faster (-9%)

--
components: Argument Clinic, Interpreter Core
messages: 373963
nosy: larry, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Convert int.__round__ to Argument Clinic
type: performance
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue41342>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41338] test_decimal emits DeprecationWarning due to PyUnicode_FromUnicode(NULL, size)

2020-07-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
nosy_count: 2.0 -> 3.0
pull_requests: +20685
pull_request: https://github.com/python/cpython/pull/21543

___
Python tracker 
<https://bugs.python.org/issue41338>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41333] Convert OrderedDict.pop() to Argument Clinic

2020-07-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41333>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41333] Convert OrderedDict.pop() to Argument Clinic

2020-07-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 6bf3237379b17632db52cb39d181e8bac70173f3 by Serhiy Storchaka in 
branch 'master':
bpo-41333: Convert OrderedDict.pop() to Argument Clinic (GH-21534)
https://github.com/python/cpython/commit/6bf3237379b17632db52cb39d181e8bac70173f3


--

___
Python tracker 
<https://bugs.python.org/issue41333>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41334] Convert str(), bytes() and bytearray() to Argument Clinic

2020-07-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +20673
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21535

___
Python tracker 
<https://bugs.python.org/issue41334>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41334] Convert str(), bytes() and bytearray() to Argument Clinic

2020-07-18 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Constructors str(), bytes() and bytearray() were not converted to Argument 
Clinic because it was not possible to generate correct signature for them. But 
now there is other reason of using Argument Clinic -- it generates more 
efficient code for parsing arguments.

The proposed PR converts str(), bytes() and bytearray() to Argument Clinic but 
generated docstrings are not used.

$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python "str()"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 81.9 ns +- 4.5 ns -> 
[/home/serhiy/py/cpython-release/python] 60.0 ns +- 1.9 ns: 1.36x faster (-27%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"str('abcdefgh')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 121 ns +- 3 ns -> 
[/home/serhiy/py/cpython-release/python] 87.6 ns +- 2.8 ns: 1.38x faster (-28%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"str(12345)"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 188 ns +- 8 ns -> 
[/home/serhiy/py/cpython-release/python] 149 ns +- 5 ns: 1.27x faster (-21%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"str(b'abcdefgh', 'ascii')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 210 ns +- 7 ns -> 
[/home/serhiy/py/cpython-release/python] 164 ns +- 6 ns: 1.28x faster (-22%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"str(b'abcdefgh', 'ascii', 'strict')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 222 ns +- 9 ns -> 
[/home/serhiy/py/cpython-release/python] 170 ns +- 6 ns: 1.30x faster (-23%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"str(b'abcdefgh', encoding='ascii', errors='strict')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 488 ns +- 20 ns -> 
[/home/serhiy/py/cpython-release/python] 306 ns +- 5 ns: 1.59x faster (-37%)

$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python "bytes()"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 85.1 ns +- 2.2 ns -> 
[/home/serhiy/py/cpython-release/python] 60.2 ns +- 2.3 ns: 1.41x faster (-29%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytes(8)"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 160 ns +- 5 ns -> 
[/home/serhiy/py/cpython-release/python] 115 ns +- 4 ns: 1.39x faster (-28%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytes(b'abcdefgh')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 131 ns +- 6 ns -> 
[/home/serhiy/py/cpython-release/python] 91.0 ns +- 2.8 ns: 1.43x faster (-30%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytes('abcdefgh', 'ascii')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 190 ns +- 6 ns -> 
[/home/serhiy/py/cpython-release/python] 144 ns +- 5 ns: 1.32x faster (-24%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytes('abcdefgh', 'ascii', 'strict')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 214 ns +- 5 ns -> 
[/home/serhiy/py/cpython-release/python] 156 ns +- 4 ns: 1.37x faster (-27%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytes('abcdefgh', encoding='ascii', errors='strict')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 442 ns +- 9 ns -> 
[/home/serhiy/py/cpython-release/python] 269 ns +- 8 ns: 1.64x faster (-39%)

$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytearray()"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 93.5 ns +- 2.1 ns -> 
[/home/serhiy/py/cpython-release/python] 73.1 ns +- 1.8 ns: 1.28x faster (-22%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytearray(8)"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 154 ns +- 3 ns -> 
[/home/serhiy/py/cpython-release/python] 117 ns +- 3 ns: 1.32x faster (-24%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytearray(b'abcdefgh')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 164 ns +- 5 ns -> 
[/home/serhiy/py/cpython-release/python] 131 ns +- 2 ns: 1.25x faster (-20%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytearray('abcdefgh', 'ascii')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 239 ns +- 7 ns -> 
[/home/serhiy/py/cpython-release/python] 193 ns +- 4 ns: 1.24x faster (-19%)
$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python 
"bytearray('abcdefgh', 'ascii', 'strict')"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 260 ns +- 5 ns -> 
[/home/serhiy/py/cpython-release/python] 207 ns +- 10 ns: 1.26x faster (-21%)
$ ./p

[issue41333] Convert OrderedDict.pop() to Argument Clinic

2020-07-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +20672
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21534

___
Python tracker 
<https://bugs.python.org/issue41333>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41333] Convert OrderedDict.pop() to Argument Clinic

2020-07-18 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

The proposed PR converts OrderedDict.pop() to Argument Clinic. It makes it 2 
times faster.

$ ./python -m pyperf timeit -q --compare-to=../cpython-release2/python -s "from 
collections import OrderedDict; od = OrderedDict()" "od.pop('x', None)"
Mean +- std dev: [/home/serhiy/py/cpython-release2/python] 119 ns +- 2 ns -> 
[/home/serhiy/py/cpython-release/python] 56.3 ns +- 1.2 ns: 2.12x faster (-53%)

It was not converted before because Argument Clinic generated incorrect 
signature for it. It still is not able to generate correct signature, but at 
least it does not generate incorrect signature. And we now have other reason 
for using Argument Clinic -- performance.

--
components: Argument Clinic, Extension Modules
messages: 373905
nosy: larry, rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Convert OrderedDict.pop() to Argument Clinic
type: performance
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue41333>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41262] Convert memoryview to Argument Clinic

2020-07-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I do not have other benchmarks. memoryview was just one of few builtins which 
still use PyArg_ParseTupleAndKeywords() and I know how inefficient it is. Since 
Argument Clinic was already used for memoryview.hex() I did not see problems 
with converting the rest of memoryview methods to Argument Clinic.

Microbenchmarks:

$ ./python -m pyperf timeit -q --compare-to=../cpython-release/python -s "b = 
b'abcdefgh'" "memoryview(b)"
Mean +- std dev: [/home/serhiy/py/cpython-release/python] 187 ns +- 6 ns -> 
[/home/serhiy/py/cpython-release2/python] 144 ns +- 4 ns: 1.30x faster (-23%)

$ ./python -m pyperf timeit -q --compare-to=../cpython-release/python -s "b = 
b'abcdefgh'" "memoryview(object=b)"
Mean +- std dev: [/home/serhiy/py/cpython-release/python] 312 ns +- 7 ns -> 
[/home/serhiy/py/cpython-release2/python] 210 ns +- 6 ns: 1.49x faster (-33%)

$ ./python -m pyperf timeit -q --compare-to=../cpython-release/python -s "m = 
memoryview(b'abcdefgh')" "m.cast('I')"
Mean +- std dev: [/home/serhiy/py/cpython-release/python] 167 ns +- 4 ns -> 
[/home/serhiy/py/cpython-release2/python] 104 ns +- 2 ns: 1.60x faster (-38%)

$ ./python -m pyperf timeit -q --compare-to=../cpython-release/python -s "m = 
memoryview(b'abcdefgh')" "m.cast(format='I')"
Mean +- std dev: [/home/serhiy/py/cpython-release/python] 331 ns +- 6 ns -> 
[/home/serhiy/py/cpython-release2/python] 153 ns +- 7 ns: 2.16x faster (-54%)

$ ./python -m pyperf timeit -q --compare-to=../cpython-release/python -s "m = 
memoryview(b'abcdefgh')" "m.cast('B', (2, 2, 2))"
Mean +- std dev: [/home/serhiy/py/cpython-release/python] 229 ns +- 5 ns -> 
[/home/serhiy/py/cpython-release2/python] 154 ns +- 4 ns: 1.48x faster (-32%)

$ ./python -m pyperf timeit -q --compare-to=../cpython-release/python -s "m = 
memoryview(b'abcdefgh')" "m.cast(format='B', shape=(2, 2, 2))"
Mean +- std dev: [/home/serhiy/py/cpython-release/python] 494 ns +- 11 ns -> 
[/home/serhiy/py/cpython-release2/python] 198 ns +- 5 ns: 2.49x faster (-60%)

$ ./python -m pyperf timeit -q --compare-to=../cpython-release/python -s "m = 
memoryview(b'abcdefgh')" "m.tobytes()"
Mean +- std dev: [/home/serhiy/py/cpython-release/python] 90.3 ns +- 3.2 ns -> 
[/home/serhiy/py/cpython-release2/python] 65.8 ns +- 1.9 ns: 1.37x faster (-27%)

$ ./python -m pyperf timeit -q --compare-to=../cpython-release/python -s "m = 
memoryview(b'abcdefgh')" "m.tobytes('C')"
Mean +- std dev: [/home/serhiy/py/cpython-release/python] 183 ns +- 6 ns -> 
[/home/serhiy/py/cpython-release2/python] 129 ns +- 4 ns: 1.41x faster (-29%)

$ ./python -m pyperf timeit -q --compare-to=../cpython-release/python -s "m = 
memoryview(b'abcdefgh')" "m.tobytes(order='C')"
Mean +- std dev: [/home/serhiy/py/cpython-release/python] 340 ns +- 11 ns -> 
[/home/serhiy/py/cpython-release2/python] 174 ns +- 5 ns: 1.96x faster (-49%)

--

___
Python tracker 
<https://bugs.python.org/issue41262>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41330] Inefficient error-handle for CJK encodings

2020-07-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

In the Web application you need first to generate data (this may involve some 
network requests, IO operations, and some data transformations), then format 
the page, then encode it, and finally send it to client. I suppose that the 
encoding part is minor in comparison with others.

Also, as Inada-san noted, UTF-8 is more popular encoding in modern 
applications. It is also fast, so you may prefer UTF-8 if the performance of 
encoding is important to you.

--

___
Python tracker 
<https://bugs.python.org/issue41330>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41262] Convert memoryview to Argument Clinic

2020-07-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41262>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41262] Convert memoryview to Argument Clinic

2020-07-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 80a50368c0e4dc9d56af0ce748dea35c9d96d23f by Serhiy Storchaka in 
branch 'master':
bpo-41262: Convert memoryview to Argument Clinic. (GH-21421)
https://github.com/python/cpython/commit/80a50368c0e4dc9d56af0ce748dea35c9d96d23f


--

___
Python tracker 
<https://bugs.python.org/issue41262>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41288] Pickle crashes unpickling invalid NEWOBJ_EX opcode

2020-07-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset b4c98ed41e6c959e95b2a6f65c1b728e94039dfd by Serhiy Storchaka in 
branch 'master':
bpo-41288: Refactor of unpickling NEWOBJ and NEWOBJ_EX opcodes. (GH-21472)
https://github.com/python/cpython/commit/b4c98ed41e6c959e95b2a6f65c1b728e94039dfd


--

___
Python tracker 
<https://bugs.python.org/issue41288>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41330] Inefficient error-handle for CJK encodings

2020-07-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am not even sure it was worth to add fast path for "xmlcharrefreplace". 
"surrogateescape" and "surrogatepass" are most likely used in performance 
critical cases. It is also easy to add support of "ignore" and "replace". 
"strict" raises an exception in any case, and "backslashreplace", 
"xmlcharrefreplace" and "namereplace" are too complex and used in cases when 
coding time is not dominant (error reporting, debugging, formatting complex 
documents).

--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41330>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41322] unittest: deprecate test methods returning non-None values

2020-07-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is also a good idea for linters to catch such kind of errors. It will help 
users of older Python versions.

We cannot raise error without deprecation period or add warnings in old 
versions because it potentially can break existing code, e.g.:

def test_ham(self, arg='ham'):
...

def test_spam(self):
res = test_ham('spam')
self.assertTrue(res)

--

___
Python tracker 
<https://bugs.python.org/issue41322>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41321] Calculate timestamp is wrong in datetime.datetime

2020-07-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It depends on timezone. I guess there was a switch to daylight saving time at 
that time and place.

--
nosy: +belopolsky, lemburg, p-ganssle, serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41321>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41322] unittest: Generator test methods will always be marked as passed

2020-07-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I would raser raise error if the test method returns something suspicious, like 
generator or coroutine. Or maybe if it returns anything except None.

--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41322>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41310] micro-optimization: increase our float parsing speed by Nx

2020-07-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

CPython is written on C, not C++, so we cannot use std::from_chars.

Note also that to parse a number in JSON we need first to scan the PyUnicode 
object character-by-character using PyUnicode_READ() which is slower than just 
reading a byte from a memory, then convert a substring to a nul-terminated 
bytes string, and finally use the conversion function  which creates a new 
PyFloat or PyLong objects. The overhead of scanning a string and memory 
management may be larger than the parsing time itself.

--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41310>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40150] (minor) mismatched argument in overlapped_RegisterWaitWithQueue call to RegisterWaitForSingleObject

2020-07-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.7, Python 3.8

___
Python tracker 
<https://bugs.python.org/issue40150>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40150] (minor) mismatched argument in overlapped_RegisterWaitWithQueue call to RegisterWaitForSingleObject

2020-07-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset af4eda46d1538b1da700a86588bdb94b0a4d1ff2 by Zackery Spytz in 
branch 'master':
bpo-40150: Fix mismatched argument in RegisterWaitForSingleObject() call 
(GH-19686)
https://github.com/python/cpython/commit/af4eda46d1538b1da700a86588bdb94b0a4d1ff2


--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue40150>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33007] Objects referencing private-mangled names do not roundtrip properly under pickling.

2020-07-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
versions: +Python 3.10 -Python 3.6, Python 3.7

___
Python tracker 
<https://bugs.python.org/issue33007>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23860] Windows: Failure to check return value from lseek() in Modules/mmapmodule.c

2020-07-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
versions: +Python 3.10 -Python 3.8

___
Python tracker 
<https://bugs.python.org/issue23860>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20183] Derby #14: Convert 41 sites to Argument Clinic across 5 files

2020-07-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset bbceef6851895135c80e588a55854c1afab46499 by Zackery Spytz in 
branch 'master':
bpo-20183: Convert _locale to the Argument Clinic (GH-14201)
https://github.com/python/cpython/commit/bbceef6851895135c80e588a55854c1afab46499


--
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue20183>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41288] Pickle crashes unpickling invalid NEWOBJ_EX opcode

2020-07-14 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +20616
pull_request: https://github.com/python/cpython/pull/21472

___
Python tracker 
<https://bugs.python.org/issue41288>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41288] Pickle crashes unpickling invalig NEWOBJ_EX opcode

2020-07-13 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
title: Pickle crashes using a crafted datetime object -> Pickle crashes 
unpickling invalig NEWOBJ_EX opcode

___
Python tracker 
<https://bugs.python.org/issue41288>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41288] Pickle crashes using a crafted datetime object

2020-07-13 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +20605
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21458

___
Python tracker 
<https://bugs.python.org/issue41288>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41288] Pickle crashes using a crafted datetime object

2020-07-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
components: +Extension Modules -Interpreter Core
nosy: +serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41288>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   3   4   5   6   7   8   9   10   >