[issue45390] asyncio.Task doesn't propagate CancelledError() exception correctly.

2022-02-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Seems a CancelledError message can be lost also in Condition.wait().

--
nosy: +serhiy.storchaka

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



[issue46829] Confusing CancelError message if multiple cancellations are scheduled

2022-02-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What about `CancelledError(*msg_list)` or 
`CancelledError(*reversed(msg_list))`? It is backward compatible and all 
messages are uniformely represented.

--
nosy: +serhiy.storchaka

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



[issue46819] Add an Error / Exception / Warning when contextlib.suppress() is entered with no specified exception(s) to suppress

2022-02-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

No, I say that

with suppress():
...

is equivalent to

try:
...
except ():
pass

or

try:
...
except BaseException as err:
if not isinstance(err, ()):
raise

If you want to suppress all exceptions (it is not very clever idea), use 
suppress(BaseException).

--

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



[issue46825] slow matching on regular expression

2022-02-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The re module does not support features corresponding to 
std::regex_constants::__polynomial in C++. Rewrite your regular expression or 
try to use alternative regex implementations (for example wrappers around the 
re2 library or C++ regex library).

--
nosy: +serhiy.storchaka
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

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



[issue46819] Add an Error / Exception / Warning when contextlib.suppress() is entered with no specified exception(s) to suppress

2022-02-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I concur with Zachary.

Note that suppress without arguments corresponds to "except" and isinstance() 
with empty tuple.

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

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



[issue46725] Unpacking without parentheses is allowed since 3.9

2022-02-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What exactly was happened? What rule was changed? Can it cause other changes 
which allow ambiguous code or change semantic?

--
nosy: +serhiy.storchaka

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



[issue46820] SyntaxError on `1not in...`

2022-02-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset f20ac2ed076df63a77f65ff2660148af9f1a9b3c by Miss Islington (bot) 
in branch '3.10':
bpo-46820: Fix a SyntaxError in a numeric literal followed by "not in" 
(GH-31479) (GH-31493)
https://github.com/python/cpython/commit/f20ac2ed076df63a77f65ff2660148af9f1a9b3c


--

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



[issue46820] SyntaxError on `1not in...`

2022-02-22 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +29624
pull_request: https://github.com/python/cpython/pull/31494

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



[issue46820] SyntaxError on `1not in...`

2022-02-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 090e5c4b946b28f50fce445916c5d3ec45c8f45f by Serhiy Storchaka in 
branch 'main':
bpo-46820: Fix a SyntaxError in a numeric literal followed by "not in" 
(GH-31479)
https://github.com/python/cpython/commit/090e5c4b946b28f50fce445916c5d3ec45c8f45f


--

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



[issue46820] SyntaxError on `1not in...`

2022-02-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46820] SyntaxError on `1not in...`

2022-02-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Good catch. Thank you for your report Patrick.

--
stage: patch review -> 

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



[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> In the long run, it would be better to migrate the implementations in the 
> other direction. Rewrite genericpath, ntpath, posixpath, and parts of shutil 
> to use PurePath and Path objects.

pathlib does not allow to distinguish "path" from "path/".

--

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



[issue39327] shutil.rmtree using vagrant synched folder fails

2022-02-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.6

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



[issue39327] shutil.rmtree using vagrant synched folder fails

2022-02-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset b77158b4da449ec5b8f682816a79d004fd65ed07 by Lital Natan in branch 
'main':
bpo-39327: Close file descriptors as soon as possible in shutil.rmtree 
(GH-31384)
https://github.com/python/cpython/commit/b77158b4da449ec5b8f682816a79d004fd65ed07


--
nosy: +serhiy.storchaka

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



[issue46807] Wrong class __annotations__ when field name and type are equal

2022-02-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Wrong type when missname dataclass attribute with existing 
variable name

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



[issue46804] Yaytext.net - Tạo văn bản chữ kiểu, kí tự đặc biệt độc đáo

2022-02-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46804] Yaytext.net - Tạo văn bản chữ kiểu, kí tự đặc biệt độc đáo

2022-02-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
Removed message: https://bugs.python.org/msg413575

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



[issue46804] Yaytext.net - Tạo văn bản chữ kiểu, kí tự đặc biệt độc đáo

2022-02-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
Removed message: https://bugs.python.org/msg413574

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



[issue46797] ast.Constant.n deprecated without warning

2022-02-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is because we did not have a plan for removing deprecates features. 
Deprecation in documentation only helps third-party code. Instead of adding a 
complex code which switches between using old and new names depending on Python 
version, the third-party code can continue to use old names without worring 
about deprecation warnings, and switch completely to using new features only 
when support of old Python versions be dropped. 3.7 and 3.8 are not so old and 
may be still supported in third-party code.

I have created a PR which adds deprecation warnings, but I am not sure that it 
is worth to include it in 3.11.

--
priority: normal -> low
resolution:  -> postponed

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



[issue46797] ast.Constant.n deprecated without warning

2022-02-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46777] Fix incorrect use of directives in asyncio documentation

2022-02-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46796] Simplify handling of removed parameter "loop" in asyncio

2022-02-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46796] Simplify handling of removed parameter "loop" in asyncio

2022-02-18 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Before 3.10 many asyncio classes did have an optional parameter "loop". It was 
deprecated in 3.8. To simplify the code, such classes inherited a constructor 
from _LoopBoundMixin which set the _loop attribute and (since 3.8) emitted a 
warning if the loop argument was passed. Since 3.10 the _LoopBoundMixin no 
longer sets the _loop attribute and always raises a TypeError if the loop 
argument is passed.

The same effect can be achieved if just remove the loop parameter (and the 
_LoopBoundMixin constructor as it will do nothing). The only difference in the 
error message: it will be standard "Lock.__init__() got an unexpected keyword 
argument 'loop'" instead of "As of 3.10, the *loop* parameter was removed from 
Lock() since it is no longer necessary". Usually we do not keep specialized 
error messages for removed parameters.

--
components: asyncio
messages: 413539
nosy: asvetlov, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Simplify handling of removed parameter "loop" in asyncio
versions: Python 3.11

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



[issue46777] Fix incorrect use of directives in asyncio documentation

2022-02-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 2923d87ca258b9d421e8147b12f0d98295ee3f8e by Serhiy Storchaka in 
branch 'main':
bpo-46777: Fix incorrect use of directives in asyncio documentation (GH-31388)
https://github.com/python/cpython/commit/2923d87ca258b9d421e8147b12f0d98295ee3f8e


--

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



[issue46780] Allow Fractions to return 1/6 for "0.17", "0.167", "0.1667", etc.

2022-02-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It would return 1/7 for "0.1" and 1/4 for "0.2". Is it what you expected?

--
nosy: +serhiy.storchaka

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



[issue46777] Fix incorrect use of directives in asyncio documentation

2022-02-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

6. The loop parameter of Task() was documented as both removed and required (if 
there is no current event loop) in 3.10.

--

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



[issue46777] Fix incorrect use of directives in asyncio documentation

2022-02-17 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46777] Fix incorrect use of directives in asyncio documentation

2022-02-17 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

There are some issues with formatting added or removed parameters in the 
asyncio module.

1. "deprecated-removed" directives were used for already removed directives. It 
should be used for deprecated features with known term of removal. For removed 
features "versionchanged" is more appropriate.

2. Text for removed parameters was too verbose. "Removed the XXX parameter" 
would be enough.

3. "versionadded" directives were used for new parameters. "versionchanged" 
directive is more appropriate. It is a date of the change in existing function, 
not the date of adding the function itself.

4. Some directives were written not in order of increasing version number.

5. In some places parameters were marked up as ``name``. *name* is commonly 
used for parameters.

--
assignee: docs@python
components: Documentation, asyncio
messages: 413404
nosy: asvetlov, docs@python, kj, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Fix incorrect use of directives in asyncio documentation
type: enhancement
versions: Python 3.10, Python 3.11

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



[issue46766] Add a class for file operations so a syntax such as open("file.img", File.Write | File.Binary | File.Disk) is possible.

2022-02-16 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

You can create a module on PyPI. If it becomes popular we could consider 
including in the stdlib.

--
nosy: +serhiy.storchaka
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

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



[issue30267] Deprecate os.path.commonprefix

2022-02-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

For now, there are three uses of commonprefix() in the stdlib:

1. In urllib.request it causes a security issue (see issue46756). commonpath() 
or just str.startswith() should be used instead.

2. In lib2to3.main. The code contains a workaround around commonprefix(). It 
could be simplified by using commonpath().

3. In unittest.util. This is the only correct use of commonprefix(). It cannot 
be replaced by commonpath().

I think that we should add commonprefix() in the string module (or maybe in a 
new module for operations on sequences), deprecate os.path.commonprefix() in 
documentation only, several versions later add a deprecation warning in 
os.path.commonprefix(), and several versions later remove 
os.path.commonprefix().

--

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



[issue46756] Incorrect authorization check in urllib.request

2022-02-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
title: Incorrect -> Incorrect authorization check in urllib.request

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



[issue46756] Incorrect

2022-02-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46756] Incorrect

2022-02-15 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

There is an error in determining a sub-URI in the urllib.request module. Due to 
it, if the user is authorized for example.org/foo, it gets also access to 
example.org/foobar.

--
components: Library (Lib)
messages: 413280
nosy: orsenthil, serhiy.storchaka
priority: high
severity: normal
status: open
title: Incorrect
type: security
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

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



[issue46622] Support decorating a coroutine with functools.cached_property

2022-02-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Note that there is a similar issue with cached generators.

>>> from functools import *
>>> @lru_cache()
... def g():
... yield 1
... 
>>> list(g())
[1]
>>> list(g())
[]

I am not sure that it is safe to detect awaitables and iterables in caching 
decorators and automatically wrap them in re-awaitable and re-iterable objects. 
But we can add explicit decorators and combine them with arbitrary caching 
decorators. For example:

@lru_cache()
@reiterable
def g():
yield 1

--

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



[issue46748] Python.h includes stdbool.h

2022-02-14 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Is it compatible with C++?

--
nosy: +serhiy.storchaka

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



[issue46705] Memory optimization for set.issubset

2022-02-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It will be even more efficient after applying a set.intersection() optimization 
in issue43464.

--

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



[issue43464] set intersections should short-circuit

2022-02-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See also issue46721. set.issuperset() can get similar optimization.

And set.issubset() will benefit from this optimization if use 
set.intersection() in issue46705.

--
keywords:  -patch
stage: patch review -> 

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



[issue43464] set intersections should short-circuit

2022-02-13 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue39805] Copying functions doesn't actually copy them

2022-02-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is by design. Functions and types are pickled by name. The copy module uses 
the pickling protocol and only use different methods for performance or for 
non-pickleable objects. Changing this will break existing code.

--
nosy: +serhiy.storchaka

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



[issue46615] Use-after-free by mutating set during set operations

2022-02-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thanks Dennis for your report and PRs.

Do you mind to analyze also uses of _PySet_NextEntry(), PyDict_Next() and 
_PyDict_Next()? Many of them look safe, but _pickle.c seems vulnerable.

--

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



[issue46615] Use-after-free by mutating set during set operations

2022-02-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset c31b8a97a8a7e8255231c9e12ed581c6240c0d6c by Dennis Sweeney in 
branch '3.9':
bpo-46615: Don't crash when set operations mutate the sets (GH-31120) (GH-31312)
https://github.com/python/cpython/commit/c31b8a97a8a7e8255231c9e12ed581c6240c0d6c


--

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



[issue45948] Unexpected instantiation behavior for xml.etree.ElementTree.XMLParser(target=None)

2022-02-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue45948] Unexpected instantiation behavior for xml.etree.ElementTree.XMLParser(target=None)

2022-02-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset cc6d8f88289917d67237a10f7a0e2439fde7a573 by Jacob Walls in branch 
'3.9':
[3.9] bpo-45948: Remove constructor discrepancy in C version of 
ElementTree.XMLParser (GH-31152) (GH-31299)
https://github.com/python/cpython/commit/cc6d8f88289917d67237a10f7a0e2439fde7a573


--

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



[issue45948] Unexpected instantiation behavior for xml.etree.ElementTree.XMLParser(target=None)

2022-02-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 168fd6453b5de15236116f9261d64601d92571ac by Jacob Walls in branch 
'main':
bpo-45948: Remove constructor discrepancy in C version of ElementTree.XMLParser 
(GH-31152)
https://github.com/python/cpython/commit/168fd6453b5de15236116f9261d64601d92571ac


--

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



[issue46726] Thread spuriously marked dead after interrupting a join call

2022-02-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +pitrou

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



[issue46483] `pathlib.PurePath.__class_getitem__` does not return `GenericAlias`

2022-02-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset e0bc8ee945af96f9395659bbe3cc30b082e7a361 by Alex Waygood in 
branch 'main':
bpo-46483: [doc] pathlib classes no longer support parameterized generics 
(GH-31281)
https://github.com/python/cpython/commit/e0bc8ee945af96f9395659bbe3cc30b082e7a361


--

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



[issue46721] Optimize set.issuperset() for non-set argument

2022-02-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
dependencies: +Use-after-free by mutating set during set operations

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



[issue46721] Optimize set.issuperset() for non-set argument

2022-02-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The new code is similar to the code of set.isdisjoint(), so we can share the 
code if generalize it.

--

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



[issue46721] Optimize set.issuperset() for non-set argument

2022-02-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46721] Optimize set.issuperset() for non-set argument

2022-02-11 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

If the argument of set.issuperset() is not a set, it is first converted to a 
set. It is equivalent to the following code:

if not isinstance(other, (set, frozenset)):
other = set(other)
# The following is equivalent to:
# return set.issubset(other, self)
for x in other:
if x not in self
return False
return True

Two drawbacks of this algorithm:

1. It creates a new set, which takes O(len(other)) time and consumes 
O(len(set(other))) memory.
2. It needs to iterate other to the end, even if the result is known earlier.

The proposed PR straightforward the code. The C code is now larger, but it no 
longer need additional memory, performs less operations and can stop earlier.

--
components: Interpreter Core
messages: 413075
nosy: rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Optimize set.issuperset() for non-set argument
type: performance
versions: Python 3.11

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



[issue46705] Memory optimization for set.issubset

2022-02-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See also issue18032.

--

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



[issue46717] Raising exception multiple times leaks memory

2022-02-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Did you try to print a traceback of the exception?

--
nosy: +serhiy.storchaka

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



[issue46622] Support decorating a coroutine with functools.cached_property

2022-02-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Something like:

_unset = ['unset']
class CachedAwaitable:
def __init__(self, awaitable):
self.awaitable = awaitable
self.result = _unset
def __await__(self):
if self.result is _unset:
self.result = yield from self.awaitable.__await__()
return self.result

--
nosy: +serhiy.storchaka

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



[issue46705] Memory optimization for set.issubset

2022-02-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Would not testing len(self.difference(other)) == 0 be more efficient? Making a 
copy of a set and removing elements one by one may be faster than add elements 
one by one, because we only need to allocate a single chunk of memory for a set.

It depends on relative values of len(self), len(other) and len(set(other)). For 
example, the following code may be optimal in some cases:

tmp = set()
it = iter(other)
for item in it:
# if item in self: ?
tmp.add(item)
if len(tmp) >= len(self):
self = self.difference(tmp, it)
if not self:
return True
self.difference_update(other)
return not self
else:
return False  # len(self) > len(set(other))

The disadvantage of such optimizations is that they make the code much more 
bigger. The current code is small and simple, and good enough in most cases.

--

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



[issue45948] Unexpected instantiation behavior for xml.etree.ElementTree.XMLParser(target=None)

2022-02-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I do not think it is a backwards incompatible change, but concur with the rest 
said by Stefan.

--

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



[issue46676] ParamSpec args and kwargs are not equal to themselves.

2022-02-08 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46676] ParamSpec args and kwargs are not equal to themselves.

2022-02-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset cbdcae5ab90710e8d82c213f3798af1154670ff9 by Gregory Beauregard in 
branch '3.10':
[3.10] bpo-46676: Make ParamSpec args and kwargs equal to themselves (GH-31203) 
(GH-31210)
https://github.com/python/cpython/commit/cbdcae5ab90710e8d82c213f3798af1154670ff9


--

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



[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

getdefaultlocale() falls back to LANG and LANGUAGE. It allows also to specify a 
list of looked up environment variables. How could this use case be covered 
with getlocale()?

--
nosy: +serhiy.storchaka

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



[issue46643] typing.Annotated cannot wrap typing.ParamSpec args/kwargs

2022-02-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Should it? Annotated wraps types, and P.args/P.kwargs are not types.

If make Annotated accepting P.args/P.kwargs (and possible other non-types, e.g. 
P), it is a new feature which should be publicly discussed first and 
documented. I do not thing it requires a PEP.

--
nosy: +serhiy.storchaka

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



[issue46676] ParamSpec args and kwargs are not equal to themselves.

2022-02-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset c8b62bbe46e20d4b6dd556f2fa85960d1269aa45 by Gregory Beauregard in 
branch 'main':
bpo-46676: Make ParamSpec args and kwargs equal to themselves (GH-31203)
https://github.com/python/cpython/commit/c8b62bbe46e20d4b6dd556f2fa85960d1269aa45


--
nosy: +serhiy.storchaka

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



[issue45948] Unexpected instantiation behavior for xml.etree.ElementTree.XMLParser(target=None)

2022-02-07 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Extension Modules
nosy: +serhiy.storchaka
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.8

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



[issue46639] Ceil division with math.ceildiv

2022-02-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Round division would be useful not less than ceil division, if not more. In the 
stdlib it would be used in:

1. The datetime module.
2. Fraction.__round__.

--

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



[issue46674] Two if in a row in generators

2022-02-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is valid syntax.

--
nosy: +serhiy.storchaka

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



[issue46611] Improve coverage of `__instancecheck__` and `__subclasscheck__` methods in `typing.py`

2022-02-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thanks Nikita.

--
components: +Tests -Library (Lib)
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10

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



[issue46611] Improve coverage of `__instancecheck__` and `__subclasscheck__` methods in `typing.py`

2022-02-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset c1ff4cb98b11c00aee765019364544c71e7dd2df by Nikita Sobolev in 
branch '3.10':
[3.10] bpo-46611: add coverage to instance and class checks in `typing.py` 
(GH-31078) (GH-31182)
https://github.com/python/cpython/commit/c1ff4cb98b11c00aee765019364544c71e7dd2df


--
nosy: +serhiy.storchaka

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



[issue46642] typing: tested TypeVar instance subclass TypeError is incidental

2022-02-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The test is good. If we accidentally make a TypeVar instance subclassable, it 
will catch such error.

--

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



[issue46644] typing: remove callable() check from typing._type_check

2022-02-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

But it gives the same result.

What version of Python do you test with?

--

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



[issue46644] typing: remove callable() check from typing._type_check

2022-02-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

No, List[42] is not currently accepted.

>>> List[42]
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython/Lib/typing.py", line 318, in inner
return func(*args, **kwds)
   ^^^
  File "/home/serhiy/py/cpython/Lib/typing.py", line 1127, in __getitem__
params = tuple(_type_check(p, msg) for p in params)
 ^^
  File "/home/serhiy/py/cpython/Lib/typing.py", line 1127, in 
params = tuple(_type_check(p, msg) for p in params)
   ^^^
  File "/home/serhiy/py/cpython/Lib/typing.py", line 184, in _type_check
raise TypeError(f"{msg} Got {arg!r:.100}.")
^^^
TypeError: Parameters to generic types must be types. Got 42.

--

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



[issue46642] typing: tested TypeVar instance subclass TypeError is incidental

2022-02-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Note that instances of most other types are non-subclassable "by accident".

>>> class A(42): pass
... 
Traceback (most recent call last):
  File "", line 1, in 
TypeError: int() takes at most 2 arguments (3 given)

>>> class B:
... def __init__(self, *args): pass
... 
>>> class C(B()): pass
... 
>>> C
<__main__.B object at 0x7fdcfb49aae0>

It is okay until we decide that there is a problem, and it that case it would 
require more general solution.

Are there any issues with this in real code?

--
nosy: +serhiy.storchaka

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



[issue46644] typing: remove callable() check from typing._type_check

2022-02-06 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +29332
pull_request: https://github.com/python/cpython/pull/31159

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



[issue46644] typing: remove callable() check from typing._type_check

2022-02-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There were two reasons of accepting arbitrary callables in _type_check():

1. NewType() returned a function.
2. xml.etree.cElementTree.Element was a function in Python 2.

Now NewType is a class, and Python 2 no longer supported. I agree that we 
should get rid of the callable() check, but I disagree with the proposed 
change. The check should be more explicit and strict, not more lenient. 
List[42] does not make sense and should not be accepted.

--
nosy: +serhiy.storchaka

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



[issue44796] Add __parameters__ and __getitem__ in TypeVar and ParamSpec

2022-02-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I have created an alternative PR 31143 which adds special method 
__typing_subst__ in TypeVar and ParamSpec instead of __parameters__ and 
__getitem__. It has almost the same effect except making TypeVar and ParamSpec 
and subscriptable. The Python code in typing.py and _collections_abc.py is 
simplified, but the C code is little changed.

But on other hand, the reasons for PR 27511:

1. We already implemented __getitem__ for a Concatenate alias, although it is 
never documented. It is not even necessary, it is a pure implementation detail 
which makes the code for nested variables substitution simpler. Adding 
__parameters__ and __getitem__ in TypeVar and ParamSpec would have the same 
effect on simplification of the code.

2. There is a use case for subscription of TypeVar. For example:

if version < 2:
   RetType = T
elif version < 3:
   RetType = Optional[T]
else:
   RetType = Optional[T] | Literal[Unknown]

def get_int(precision: int) -> RetType[int]: ...
def get_str(encoding: str) -> RetType[str]: ...
def get_any(converter: Callable[[str], T]) -> RetType[T]: ...

--

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



[issue44796] Add __parameters__ and __getitem__ in TypeVar and ParamSpec

2022-02-05 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +29321
pull_request: https://github.com/python/cpython/pull/31143

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



[issue41259] Find adverbs is not correct on the documentation

2022-02-05 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue42353] Proposal: re.prefixmatch method (alias for re.match)

2022-02-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am not convinced. What are examples of using re.match() instead of 
re.search()? How common is this type of errors?

There are perhaps many millions of scripts which use re.match(), deprecating 
re.match() at any time in future would be very destructive, and keeping an 
alias indefinitely would only add more confusion.

--

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



[issue46639] Ceil division with math.ceildiv

2022-02-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See also issue31978.

--
nosy: +serhiy.storchaka

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



[issue44796] Add __parameters__ and __getitem__ in TypeVar and ParamSpec

2022-02-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It does not have a use case of T[int] in mind. It is an implementation detail 
which simplifies the code, makes runtime checks more strict and makes 
types.GenericAlias more similar to typing._GenericAlias.

For example, currently:

>>> A = List[T]
>>> B = list[T]
>>> A[None]
typing.List[NoneType]
>>> B[None]
list[None]
>>> A['X']
typing.List[ForwardRef('X')]
>>> B['X']
list['X']

With the proposed change:

>>> B[None]
list[NoneType]
>>> B['X']
list[ForwardRef('X')]

Meanless expressions like A[42], A[Final], A[Final[int]], A[ClassVar], 
A[ClassVar[int]], etc which are silently accepted will now be errors.

The code simplification (especially for the C code) is my primary goal, and the 
rest is a nice side effect. It is possible to add more strict runtime checks 
and conversions without making TypeVar and ParamSpec subscriptable, but the 
code will not be so simple.

--

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



[issue44977] Deprecate delegation of int to __trunc__

2022-02-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thanks Zackery.

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

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



[issue44977] Deprecate delegation of int to __trunc__

2022-02-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset b4bd1e1422997de61faf506b4916e83013bc7d21 by Zackery Spytz in 
branch 'main':
bpo-44977: Deprecate delegation of int to __trunc__ (GH-31031)
https://github.com/python/cpython/commit/b4bd1e1422997de61faf506b4916e83013bc7d21


--

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



[issue46483] `pathlib.PurePath.__class_getitem__` does not return `GenericAlias`

2022-02-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 7ffe7ba30fc051014977c6f393c51e57e71a6648 by Nikita Sobolev in 
branch 'main':
bpo-46483: Remove `__class_getitem__` from `pathlib.PurePath` (GH-30848)
https://github.com/python/cpython/commit/7ffe7ba30fc051014977c6f393c51e57e71a6648


--

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



[issue46483] `pathlib.PurePath.__class_getitem__` does not return `GenericAlias`

2022-02-03 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46565] Delete module-level loop variables when no longer needed

2022-02-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 0cbdd2131195b0d313762968f604e80a3e65ca9f by Nikita Sobolev in 
branch 'main':
bpo-46565: `del` loop vars that are leaking into module namespaces (GH-30993)
https://github.com/python/cpython/commit/0cbdd2131195b0d313762968f604e80a3e65ca9f


--
nosy: +serhiy.storchaka

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



[issue46610] assertCountEqual doesn't work as expected for dictionary elements

2022-02-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Concur with Eric and Raymond.

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

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



[issue46615] Use-after-free by mutating set during set operations

2022-02-03 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

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



[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()

2022-01-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There is nothing wrong with writing two lines of code. And two lines of code 
may be more readable than one line of code. New method or parameter has a cost 
-- core developers need to maintain it, update documentation and tests if they 
conflict with new features, user will need to learn about it, remember 
differences between Python versions and implementations of different Path-like 
objects, it can be only used after dropping support of older Python versions, 
and it may be a source of common mistakes.

If you think that it is so important to use a single call for appending to a 
file, you can create a module which provides functions append_text() and 
append_bytes(). They could be used even in Python versions older than 3.11.

--

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



[issue46555] Unicode-mangled names refer inconsistently to constants

2022-01-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

https://docs.python.org/3/library/constants.html#built-in-constants

--

___
Python tracker 
<https://bugs.python.org/issue46555>
___
___
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

2022-01-29 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +29195
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



[issue46555] Unicode-mangled names refer inconsistently to constants

2022-01-29 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

True is a keyword which is compiled to expression whose value is True, 핋핣핦핖 is 
an identifier which refers to the builtin variable "True" which has a value 
True by default. You can change the value of a builtin variable, but the value 
of expression True is always True.

I do not see a problem here. Don't use 핋핣핦핖 if your intention is not using a 
variable.

--
nosy: +serhiy.storchaka

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



[issue46500] make timeit module accept files

2022-01-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Usually, when you benchmark a non-trivial piece of code, you need also to 
specify a setup code. If the benchmarked code is large enough to be read from a 
file, the setup code should be read from a file too.

The common practice is to write the benchmarked code as a function which can be 
imported and repeatedly executed.

$ python -m timeit -s 'from mybench import test' 'test()'

--

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



[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()

2022-01-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think it should be closed for the same reasons as #35095. It is not common 
enough case to complicate Path.write_text(), and you always can use 
open()+write().

--
nosy: +serhiy.storchaka

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



[issue44791] Substitution of ParamSpec in Concatenate

2022-01-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 27518 fixes a substitution of a ParamSpec variable with a Concatenate nad a 
list of types. It is not specified explicitly in PEP 612, but it does not 
contradict it.

PR 30969 makes an ellipsis be valid as the last argument of Concatenate to fix 
a substitution of a ParamSpec variable with an ellipsis. It contradicts with 
PEP 612 which allows only a ParamSpec variable there.

--

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



[issue44791] Substitution of ParamSpec in Concatenate

2022-01-27 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +29147
pull_request: https://github.com/python/cpython/pull/30969

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



[issue44791] Substitution of ParamSpec in Concatenate

2022-01-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset ecfacc362dd7fef7715dcd94f2e2ca6c622ef115 by Serhiy Storchaka in 
branch 'main':
bpo-44791: Fix substitution of ParamSpec in Concatenate with different 
parameter expressions (GH-27518)
https://github.com/python/cpython/commit/ecfacc362dd7fef7715dcd94f2e2ca6c622ef115


--

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



[issue46544] `textwrap.TextWrapper` leaks two intermediate vars into class namespace

2022-01-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 82bce54614f8116a40454fbbbf96a3fd460ca7df by Nikita Sobolev in 
branch 'main':
bpo-46544: Do not leak `x` and `uspace` in textwrap.TextWrapper (GH-30955)
https://github.com/python/cpython/commit/82bce54614f8116a40454fbbbf96a3fd460ca7df


--
nosy: +serhiy.storchaka

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



[issue46483] `pathlib.PurePath.__class_getitem__` does not return `GenericAlias`

2022-01-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is not related to email and asyncio either.

--
components:  -asyncio, email

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



[issue46426] Improve tests for the dir_fd argument

2022-01-24 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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



[issue46426] Improve tests for the dir_fd argument

2022-01-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 3f1ea163ea54513e00e0e9d5442fee1b639825cc by Serhiy Storchaka in 
branch '3.9':
[3.9] bpo-46426: Improve tests for the dir_fd argument (GH-30668) (GH-30757)
https://github.com/python/cpython/commit/3f1ea163ea54513e00e0e9d5442fee1b639825cc


--

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



[issue46500] make timeit module accept files

2022-01-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This module provides a simple way to time small bits of Python code.

What problem are you trying to solve.

--
nosy: +serhiy.storchaka

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



[issue46157] Typo in JSON documentation

2022-01-24 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions:  -Python 3.10, Python 3.9

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



[issue21987] TarFile.getmember on directory requires trailing slash iff over 100 chars

2022-01-23 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.5

___
Python tracker 
<https://bugs.python.org/issue21987>
___
___
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   >