[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/c8b62bbe46e20d4b6dd556f2fa8596

[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

[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

[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/cpyt

[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.or

[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/issue45

[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

[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 =

[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/issue46

[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 Unsub

[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

[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/issu

[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/issue46

[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/issue46

[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/e0bc8ee945af96f9395659bbe3cc30

[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:

[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/cpyt

[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/cpyt

[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.or

[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/c31b8a97a8a7e8255231c9e12

[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

[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

[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.p

[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

[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/issue46

[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> ___ ___ Pytho

[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

[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

[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/issu

[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/issu

[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

[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 ___ Pytho

[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. F

[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/issu

[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/issue46

[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://bug

[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/2923d87ca258b9d421e8147b12f0d9

[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 i

[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/issu

[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.or

[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/issu

[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

[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-bug

[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-bug

[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.or

[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

[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/b77158b4da449ec5b8f682816a79d0

[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.or

[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 "pa

[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/issu

[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/issu

[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/p

[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/issue46

[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/p

[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/issue46

[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

[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

[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

[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 <ht

[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/issue45

[issue46622] Add an async variant of lru_cache for coroutines.

2022-02-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think that it would be simpler to add a decorator which wraps the result of an asynchronous function into an object which can be awaited more than once: def reawaitable(func): @wraps(func) def wrapper(*args, **kwargs): return

[issue46622] Add an async variant of lru_cache for coroutines.

2022-02-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: async_lru_cache() and async_cached_property() can be written using that decorator. The implementation of async_lru_cache() is complicated because the interface of lru_cache() is complicated. But it is simpler than using _lru_cache_wrapper(). def

[issue46829] Confusing CancelError message if multiple cancellations are scheduled

2022-02-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: For reference, the msg parameter of Task.cancel() was added in issue31033. It seems that the initial use case was for debugging. I do not see how it differs from the following example: r = random.random() if r < 0.5: x = 0 e

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

2022-02-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Also Future.result() and Future.exception() can raise a CancelledError. So a CancelledError raised in a task may not contain a message passed to Task.cancel(). import asyncio import random async def main(): fut = asyncio.Future() fut.cancel

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

2022-02-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 98c3bea4d1c7335135e60946d0ec8cd5031fb6c0 by Serhiy Storchaka in branch 'main': bpo-46820: Refactor tests for ambiguous end of numerical literal (GH-31494) https://github.com/python/cpython/commit/98c3bea4d1c7335135e60946d0ec8c

[issue46756] Incorrect authorization check in urllib.request

2022-02-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, it is the same. I should search before writing a patch. But for some reasons I prefer my solution over the one proposed in issue42766: The code is clearer and more strict, tests use public API instead of a private method

[issue46756] Incorrect authorization check in urllib.request

2022-02-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset e2e72567a1c94c548868f6ee5329363e6036057a by Serhiy Storchaka in branch 'main': bpo-46756: Fix authorization check in urllib.request (GH-31353) https://github.com/python/cpython/commit/e2e72567a1c94c548868f6ee532936

[issue46756] Incorrect authorization check in urllib.request

2022-02-25 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +lukasz.langa, ned.deily, pablogsal priority: high -> release blocker ___ Python tracker <https://bugs.python.org/issu

[issue42766] urllib.request.HTTPPasswordMgr uses commonprefix instead of commonpath

2022-02-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Sorry I did not notice this issue. It is now solved in issue46756. In any case thank you for the report and the PR. -- nosy: +serhiy.storchaka resolution: -> duplicate stage: patch review -> resolved status: open -> closed s

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

2022-02-25 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.11 ___ Python tracker <https://bugs.python.or

[issue46865] *() Invalid Syntax: iterable unpacking of empty tuple

2022-02-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is an invalid syntax. Write foo(*((stri,) if stri else ())). -- nosy: +serhiy.storchaka resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bug

[issue46865] *() Invalid Syntax: iterable unpacking of empty tuple

2022-02-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See the grammar. https://docs.python.org/3/reference/expressions.html#conditional-expressions conditional_expression ::= or_test ["if" or_test "else" expression] expression ::= conditional_expression | lambda_expr `*()`

[issue38415] @asynccontextmanager decorated functions are not callable like @contextmanager

2022-02-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset b57dbe5d1be925b99f16fe5893e339f92fc05888 by Thomas Grainger in branch 'main': bpo-38415: Remove redundant AsyncContextDecorator.__call__ override from _AsyncGeneratorContextManager (GH-30233) https://github.com/python/cpyt

[issue46866] bytes class extension with slices

2022-02-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, it is consistent with all of builtin types. If you want to return a different type, override __getitem__(). -- nosy: +serhiy.storchaka resolution: -> not a bug stage: -> resolved status: open -&g

[issue46864] Deprecate ob_shash in BytesObject

2022-02-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think it is a legacy of Python 2. Attributes and variable names are Unicode strings in Python 3, so the main reason of this optimization is no longer relevant. But some programs can still work with encoded bytes instead of strings. In particular

[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Please don't revert all changes. It will not make it working right in any case. See issue44863 for more correct approach. -- ___ Python tracker <https://bugs.python.org/is

[issue44863] Allow TypedDict to inherit from Generics

2022-03-05 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue44863> ___ ___ Python-bugs-list mailing list Unsub

[issue46927] Improve error message for subscripting non-generic types

2022-03-05 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : Currently, if you try to subscript a non-generic type you will get an error: >>> int[str] Traceback (most recent call last): File "", line 1, in TypeError: 'type' object is not subscriptable Yes, 'type' objects

[issue46927] Improve error message for subscripting non-generic types

2022-03-05 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +gvanrossum, kj ___ Python tracker <https://bugs.python.org/issue46927> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46927] Improve error message for subscripting non-generic types

2022-03-05 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +29814 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31694 ___ Python tracker <https://bugs.python.org/issu

[issue46927] Improve error message for subscripting non-generic types

2022-03-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset ab9301a28fa431d7a32163126fc96de3b2ce6107 by Serhiy Storchaka in branch 'main': bpo-46927: Include the type's name in the error message for subscripting non-generic types (GH-31694) https://github.com/python

[issue46927] Improve error message for subscripting non-generic types

2022-03-05 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue46928] type.__qualname__ ignores module name in tp_name for static types

2022-03-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What do you expect? The full qualified name of the object is __module__ + '.' + __qualname__. -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.o

[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'

2022-03-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset eafec26ae5327bb23b6dace2650b074c3327dfa0 by MojoVampire in branch 'main': bpo-14156: Make argparse.FileType work correctly for binary file modes when argument is '-' (GH-13165) https://github.com/p

[issue43292] xml.ElementTree iterparse filehandle left open

2022-03-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 496c428de3318c9c5770937491b71dc3d3f18a6a by Jacob Walls in branch 'main': bpo-43292: Fix file leak in `ET.iterparse()` when not exhausted (GH-31696) https://github.com/python/cpython/commit/496c428de3318c9c5770937491b71d

[issue46341] duplicate paragraphs - asyncio Coroutines and Tasks file

2022-03-07 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> duplicate stage: needs patch -> resolved status: open -> closed superseder: -> Fix incorrect use of directives in asyncio documentation ___ Python tracker <https://bugs.python

[issue43292] xml.ElementTree iterparse filehandle left open

2022-03-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 852d9b77abefcad2bb8d203e3ab9f2ca49ab305f by Miss Islington (bot) in branch '3.9': [3.9] bpo-43292: Fix file leak in `ET.iterparse()` when not exhausted (GH-31696) (GH-31720) https://github.com/python/cpyt

[issue43292] xml.ElementTree iterparse filehandle left open

2022-03-07 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- components: +Library (Lib) resolution: -> fixed stage: patch review -> resolved status: open -> closed superseder: Add the close method for ElementTree.iterparse() object -> versions: +Python 3.10,

[issue46953] use FASTCALL for __import__ builtin

2022-03-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: __import__() usually is not called directly, and in common case (when it is not overridden) the overhead of the call is avoided completely in the import statement. And in non-trivial case, it would only save 80 microseconds if you import 1000 modules. I

[issue46947] unicodedata.name gives ValueError for control characters

2022-03-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is a duplicate of issue18234. -- nosy: +serhiy.storchaka resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Unicodedata module should provide access to codep

[issue44439] stdlib wrongly uses len() for bytes-like object

2022-03-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 36dd7396fcd26d8bf9919d536d05d7000becbe5b by Ma Lin in branch 'main': bpo-44439: _ZipWriteFile.write() handle buffer protocol correctly (GH-29468) https://github.com/python/cpython/commit/36dd7396fcd26d8bf9919d536d05d7

[issue23325] Turn SIG_DFL and SIG_IGN into functions

2022-03-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Agree. There were too many changes in this code, and making SIG_DFL and SIG_IGN functions exposes some issues with sharing objects between interpreters. It is easier to keep them integers for now. -- ___ Python

[issue46953] use FASTCALL for __import__ builtin

2022-03-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The recommended way is to use importlib.import_module(). -- ___ Python tracker <https://bugs.python.org/issue46953> ___ ___

[issue46953] use FASTCALL for __import__ builtin

2022-03-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What is the advantage of not touching a stable code? It was never a performance critical part of the code. This is why it avoided multiple previous optimizations. It is still use PyArg_ParseTupleAndKeywords(). Of course now, when optimization is provided

[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-09 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +29887 pull_request: https://github.com/python/cpython/pull/31781 ___ Python tracker <https://bugs.python.org/issue43

[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PR 31781 is a simple PR which enables multiple inheritance with NamedTuple. As a side effect, it adds support of generic NamedTuple. I am not sure that all details work as expected. It is easy to limit multiple inheritance only for Generic if needed

[issue46245] Add support for dir_fd in shutil.rmtree()

2022-03-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 02fbaf4887deaf0207a5805d3736e0124a694c14 by Serhiy Storchaka in branch 'main': bpo-46245: Add optional parameter dir_fd in shutil.rmtree() (GH-30365) https://github.com/python/cpython/commit/02fbaf4887deaf0207a5805d3736e0

[issue46245] Add support for dir_fd in shutil.rmtree()

2022-03-09 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue25927] add dir_fd for mkstemp, and also maybe to all tempfile.*

2022-03-09 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +29890 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/31785 ___ Python tracker <https://bugs.python.org/issu

[issue25927] add dir_fd for mkstemp, and also maybe to all tempfile.*

2022-03-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There are two ways of supporting an open file descriptor to a directory: 1. Accept a file descriptor as the dir argument. 2. Add a new parameter dir_fd; dir will then be a path relative to dir_fd. The original proposition is option 2. PR 31785 implements

<    1   2   3   4   5   6   7   8   9   10   >