[issue47087] Implement PEP 655 (Required/NotRequired)
Change by Jelle Zijlstra : -- keywords: +patch pull_requests: +30444 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/32419 ___ Python tracker <https://bugs.python.org/issue47087> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46981] Empty typing.Tuple
Jelle Zijlstra added the comment: I tried out 3.11 on my pyanalyze type checker and got some failures because of this change, because my previous trick for distinguishing between Tuple and Tuple[()] failed. 3.10: >>> from typing import get_args, Tuple >>> get_args(Tuple[()]) ((),) >>> get_args(Tuple) () 3.11: >>> from typing import get_args, Tuple >>> get_args(Tuple[()]) () >>> get_args(Tuple) () However, the new behavior is more consistent: get_args(tuple[()]) always returned (). It's also easy enough to work around (just check `... is Tuple`). I'll put a note in the What's New for 3.11 about this change. -- ___ Python tracker <https://bugs.python.org/issue46981> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47255] Many broken :meth: roles in the docs
Jelle Zijlstra added the comment: There are a lot of places in the rest of the docs that have the same problem: Doc % git grep ':meth:`__' | grep -v whatsnew | wc -l 610 I wonder if we can make the :meth: role globally default to linking to object.__dunder__. Would that require a change to Sphinx? -- ___ Python tracker <https://bugs.python.org/issue47255> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47255] Many broken :meth: roles in the docs
Change by Jelle Zijlstra : -- keywords: +patch pull_requests: +30435 stage: -> patch review pull_request: https://github.com/python/cpython/pull/32409 ___ Python tracker <https://bugs.python.org/issue47255> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47255] Many broken :meth: roles in the docs
New submission from Jelle Zijlstra : The docs for the hash() builtin use :meth:`__hash__`, but this doesn't actually link to the datamodel documentation for __hash__: it needs :meth:`~object.__hash__` instead. I'm fixing this in the builtin functions docs, but there are probably more places. Why don't we warn when a :meth: link doesn't actually create a link? -- assignee: docs@python components: Documentation messages: 416956 nosy: JelleZijlstra, docs@python priority: normal severity: normal status: open title: Many broken :meth: roles in the docs versions: Python 3.10, Python 3.11, Python 3.9 ___ Python tracker <https://bugs.python.org/issue47255> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47254] enhanced dir?
Jelle Zijlstra added the comment: This would be nice, but backward compatibility alone means we can't change dir() to return a dictionary. What you propose would make more sense as a new function, perhaps in a package like pydoc or a third-party tool like IPython. -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue47254> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47237] Inheritance from base class with property in class makes them non-instantiatable
Jelle Zijlstra added the comment: I think the behavior with regular classes is expected (that's just how inheritance works), but a case could be made that dataclasses should handle this case specially. -- ___ Python tracker <https://bugs.python.org/issue47237> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47234] PEP-484 "numeric tower" approach makes it hard/impossible to specify contracts in documentation
Jelle Zijlstra added the comment: Thanks for your report, but I would appreciate a more concise explanation. Let me try to rephrase the problem. Given this function: def mean(x: list[float]) -> float: return sum(x) / len(x) We want to provide a guarantee that if x is a nonempty list containing only floats, the function returns successfully and returns a float. But the type system currently doesn't give this guarantee, because PEP 484 specifies that ints are compatible with floats, and `mean([0.0, 1.25, 10**1000, 0.0])` will throw OverflowError. --- We generally discuss issues with the general type system over at https://github.com/python/typing/issues, but here are a few thoughts: - The type system doesn't generally try to cover exceptions. Your function could also raise MemoryError, or KeyboardInterrupt, and the type system can't tell you. - The concrete proposal here would be to make int no longer implicitly compatible with float. That might be nice, but at this point it would be a big break in backwards compatibility, so I'm not sure we can do it. -- nosy: +AlexWaygood, JelleZijlstra, gvanrossum, kj ___ Python tracker <https://bugs.python.org/issue47234> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47088] Implement PEP 675 (LiteralString)
Change by Jelle Zijlstra : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue47088> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47088] Implement PEP 675 (LiteralString)
Jelle Zijlstra added the comment: New changeset cfb849a326e52a4edc577112ebf60e1d9d0d7fdb by Jelle Zijlstra in branch 'main': bpo-47088: Add typing.LiteralString (PEP 675) (GH-32064) https://github.com/python/cpython/commit/cfb849a326e52a4edc577112ebf60e1d9d0d7fdb -- ___ Python tracker <https://bugs.python.org/issue47088> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41930] Wrap sqlite3_serialize API in sqlite3 module
Jelle Zijlstra added the comment: Thanks, this will be in Python 3.11. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue41930> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41930] Wrap sqlite3_serialize API in sqlite3 module
Jelle Zijlstra added the comment: New changeset a7551247e7cb7010fb4735281f1afa4abeb8a9cc by Erlend Egeberg Aasland in branch 'main': bpo-41930: Add support for SQLite serialise/deserialise API (GH-26728) https://github.com/python/cpython/commit/a7551247e7cb7010fb4735281f1afa4abeb8a9cc -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue41930> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45790] Inaccurate phrasing in extending/newtypes_tutorial
Jelle Zijlstra added the comment: New changeset d1fb16ae286795abe3e9da86332c891b4b18826f by Jelle Zijlstra in branch '3.9': [3.9] bpo-45790: List macros in same order in which fields are described (GH-29529) (GH-32321) https://github.com/python/cpython/commit/d1fb16ae286795abe3e9da86332c891b4b18826f -- ___ Python tracker <https://bugs.python.org/issue45790> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40982] copytree example in shutil
Jelle Zijlstra added the comment: Thanks for the report and patch! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue40982> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40982] copytree example in shutil
Jelle Zijlstra added the comment: New changeset e06f920c5bc6e9fad29082ba0d84043722806e17 by Zackery Spytz in branch 'main': bpo-40982: shutil docs: Remove outdated copytree() example (GH-24778) https://github.com/python/cpython/commit/e06f920c5bc6e9fad29082ba0d84043722806e17 -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue40982> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43224] Add support for PEP 646
Jelle Zijlstra added the comment: New changeset 772d8080c9fd635c3999673ca9fad8b674385c7f by Matthew Rahtz in branch 'main': bpo-43224: typing: Add tests for pickling and copying of unpacked native tuple (GH-32159) https://github.com/python/cpython/commit/772d8080c9fd635c3999673ca9fad8b674385c7f -- ___ Python tracker <https://bugs.python.org/issue43224> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32658] Metacharacter (\) documentation suggestion
Jelle Zijlstra added the comment: Thanks for the patch! -- ___ Python tracker <https://bugs.python.org/issue32658> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32658] Metacharacter (\) documentation suggestion
Jelle Zijlstra added the comment: New changeset 43571a3eea8b5931769376daf4bdad1c9184ae0d by Mike cm in branch 'main': bpo-32658: Regex docs: Fix metacharacter reference (GH-32230) https://github.com/python/cpython/commit/43571a3eea8b5931769376daf4bdad1c9184ae0d -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue32658> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45790] Inaccurate phrasing in extending/newtypes_tutorial
Jelle Zijlstra added the comment: Thanks for noticing and fixing! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue45790> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45790] Inaccurate phrasing in extending/newtypes_tutorial
Change by Jelle Zijlstra : -- pull_requests: +30382 pull_request: https://github.com/python/cpython/pull/32321 ___ Python tracker <https://bugs.python.org/issue45790> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47007] [doc] str docs are inconsistent with special method lookup
Jelle Zijlstra added the comment: Thanks for the report and fix! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue47007> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45790] Inaccurate phrasing in extending/newtypes_tutorial
Jelle Zijlstra added the comment: New changeset b275267aa7d44ec90fa435c9cb1610c549da745a by rtobar in branch 'main': bpo-45790: List macros in same order in which fields are described (GH-29529) https://github.com/python/cpython/commit/b275267aa7d44ec90fa435c9cb1610c549da745a -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue45790> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46998] Allow subclassing Any at runtime
Jelle Zijlstra added the comment: Thanks for the idea and patch! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46998> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46998] Allow subclassing Any at runtime
Jelle Zijlstra added the comment: New changeset 5a4973e29f2f5c4ee8c086f40325786c62381540 by Shantanu in branch 'main': bpo-46998: Allow subclassing Any at runtime (GH-31841) https://github.com/python/cpython/commit/5a4973e29f2f5c4ee8c086f40325786c62381540 -- ___ Python tracker <https://bugs.python.org/issue46998> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47007] [doc] str docs are inconsistent with special method lookup
Jelle Zijlstra added the comment: New changeset bb86d1d9fbd1888524e04475383f4ea764277f67 by Vanshaj Singhania in branch 'main': bpo-47007: [doc] `str` special method lookup (GH-31863) https://github.com/python/cpython/commit/bb86d1d9fbd1888524e04475383f4ea764277f67 -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue47007> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41233] Missing links to errnos on Built-in Exceptions page
Jelle Zijlstra added the comment: Thanks for the patch! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue41233> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41233] Missing links to errnos on Built-in Exceptions page
Jelle Zijlstra added the comment: New changeset a74892cb2168d249d9a8c53fad605a5def9b41d4 by yyyan in branch 'main': bpo-41233: Add links to errnos referenced in exceptions docs (GH-21380) https://github.com/python/cpython/commit/a74892cb2168d249d9a8c53fad605a5def9b41d4 -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue41233> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47097] Document PEP 646
Jelle Zijlstra added the comment: New changeset 38ae5b8c0c0b64ae6100b0dee8707d5ab769e381 by Matthew Rahtz in branch 'main': bpo-47097: Add documentation for TypeVarTuple (#32103) https://github.com/python/cpython/commit/38ae5b8c0c0b64ae6100b0dee8707d5ab769e381 -- ___ Python tracker <https://bugs.python.org/issue47097> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47219] asyncio with two interpreter instances
Change by Jelle Zijlstra : -- nosy: +eric.snow ___ Python tracker <https://bugs.python.org/issue47219> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42012] typing support in wsgiref
Jelle Zijlstra added the comment: This seems useful to me but I don't have experience with wsgiref. pje is listed as the maintainer in the devguide but appears to be inactive. I'd suggest you open a PR and if anyone feels strongly against it, they can complain. -- nosy: +JelleZijlstra, pje ___ Python tracker <https://bugs.python.org/issue42012> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47206] pickle docs are wrong about nested classes
New submission from Jelle Zijlstra : https://docs.python.org/3.10/library/pickle.html#what-can-be-pickled-and-unpickled says that only "classes that are defined at the top level of a module" can be pickled. But in fact these work fine in current Python, probably since 3.3 when __qualname__ was added (https://docs.python.org/3/library/stdtypes.html#definition.__qualname__). Similarly, the docs claim only top-level functions can be pickled, but in fact methods nested in classes work fine. Example script demonstrating that these work: import pickle class X: class Y: pass def method(self): pass print(pickle.dumps(X.Y)) print(pickle.loads(pickle.dumps(X.Y))) print(pickle.dumps(X.Y())) print(pickle.loads(pickle.dumps(X.Y( print(pickle.dumps(X.method)) print(pickle.loads(pickle.dumps(X.method))) -- assignee: docs@python components: Documentation messages: 416625 nosy: JelleZijlstra, alexandre.vassalotti, docs@python priority: normal severity: normal status: open title: pickle docs are wrong about nested classes type: behavior versions: Python 3.10, Python 3.11, Python 3.9 ___ Python tracker <https://bugs.python.org/issue47206> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47031] math.nan should note that NANs do not compare equal to anything
Jelle Zijlstra added the comment: Thanks for the bug report and patch! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue47031> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45584] Clarifying truncating in documentation
Jelle Zijlstra added the comment: Thanks for the patch! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue45584> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45584] Clarifying truncating in documentation
Jelle Zijlstra added the comment: New changeset ebbdbbff5d6840807e46ec61b8a323e94ee88de2 by Arthur Milchior in branch 'main': bpo-45584: Clarify `math.trunc` documentation (GH-29183) https://github.com/python/cpython/commit/ebbdbbff5d6840807e46ec61b8a323e94ee88de2 -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue45584> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45114] bad example for os.stat
Change by Jelle Zijlstra : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue45114> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45114] bad example for os.stat
Jelle Zijlstra added the comment: New changeset c93a0ac6972221787d8bea1c41a9feb667ed3d2c by 180909 in branch 'main': bpo-45114: Use lstat() instead of stat() in stat docs example (GH-29845) https://github.com/python/cpython/commit/c93a0ac6972221787d8bea1c41a9feb667ed3d2c -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue45114> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26792] docstrings of runpy.run_{module,path} are rather sparse
Change by Jelle Zijlstra : -- nosy: +JelleZijlstra nosy_count: 4.0 -> 5.0 pull_requests: +30330 pull_request: https://github.com/python/cpython/pull/32265 ___ Python tracker <https://bugs.python.org/issue26792> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47031] math.nan should note that NANs do not compare equal to anything
Jelle Zijlstra added the comment: New changeset 182e93c3f57b0c72e765c9896066d32e461c0865 by Charlie Zhao in branch 'main': bpo-47031: Improve documentation for `math.nan` (GH-32170) https://github.com/python/cpython/commit/182e93c3f57b0c72e765c9896066d32e461c0865 -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue47031> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47202] Feature request: Throw an error when making impossible evaluation against an empty list
Jelle Zijlstra added the comment: This sort of thing would be better caught by a linter or type checker. For example, mypy with the `--warn-unreachable` option will flag the `while None:` example. Iterating over an empty list will not currently be caught by mypy, but it's common in real code to iterate over a list that may be empty, so it would be a major compatibility break for Python to error when iterating over an empty list. -- nosy: +JelleZijlstra resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue47202> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47166] Dataclass transform should ignore TypeAlias variables
Jelle Zijlstra added the comment: >From a typing perspective this is reasonable. See this thread about type >aliases in class scopes: >https://mail.python.org/archives/list/typing-...@python.org/thread/CGOO7GPPECGMLFDUDXSSXTRADI4BXYCS/ > However, it's a niche use case and we could decide that we don't want to further complicate the annotation parsing in dataclasses.py. -- ___ Python tracker <https://bugs.python.org/issue47166> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47166] Dataclass transform should ignore TypeAlias variables
Change by Jelle Zijlstra : -- nosy: +AlexWaygood, GBeauregard, JelleZijlstra ___ Python tracker <https://bugs.python.org/issue47166> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42340] KeyboardInterrupt should come with a warning
Jelle Zijlstra added the comment: Thanks for the patch! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue42340> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42340] KeyboardInterrupt should come with a warning
Jelle Zijlstra added the comment: New changeset d0906c90fcfbc4cfb9bb963eaa6bb152dd543b56 by benfogle in branch 'main': bpo-42340: Document issues around KeyboardInterrupt (GH-23255) https://github.com/python/cpython/commit/d0906c90fcfbc4cfb9bb963eaa6bb152dd543b56 -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue42340> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28516] contextlib.ExitStack.__enter__ has trivial but undocumented behavior
Jelle Zijlstra added the comment: Thanks for the patch! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue28516> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28516] contextlib.ExitStack.__enter__ has trivial but undocumented behavior
Jelle Zijlstra added the comment: New changeset 604d003ab4d1084ef828ebca1b28f2bf1b93c744 by Jelle Zijlstra in branch '3.10': [3.10] bpo-28516: document contextlib.ExitStack.__enter__ behavior (GH-31636) (GH-32171) https://github.com/python/cpython/commit/604d003ab4d1084ef828ebca1b28f2bf1b93c744 -- ___ Python tracker <https://bugs.python.org/issue28516> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28516] contextlib.ExitStack.__enter__ has trivial but undocumented behavior
Change by Jelle Zijlstra : -- pull_requests: +30249 pull_request: https://github.com/python/cpython/pull/32171 ___ Python tracker <https://bugs.python.org/issue28516> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47143] Add types.copy_class() which updates closures
Jelle Zijlstra added the comment: I mean that the code sample above from attrs doesn't properly update the closure for wrapped methods, such as those created by @functools.cache, or any other arbitrary decorator that creates a wrapper function. Example (with Python 3.9.4 and attrs 21.4.0): % cat attrslots.py import attr import functools class Base: @classmethod def f(cls): return 3 @attr.s(slots=True) class Child(Base): x: int @classmethod @functools.cache def f(cls): return super().f() + 1 print(Child.f()) % python attrslots.py Traceback (most recent call last): File "/Users/jelle/py/pyanalyze/samples/attrslots.py", line 21, in print(Child.f()) File "/Users/jelle/py/pyanalyze/samples/attrslots.py", line 18, in f return super().f() + 1 TypeError: super(type, obj): obj must be an instance or subtype of type If we provide a `types.copy_class()`, it should handle this case correctly. -- ___ Python tracker <https://bugs.python.org/issue47143> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47143] Add functools.copy_class() which updates closures
Jelle Zijlstra added the comment: I believe the attrs code wouldn't work if a method is decorated with a decorator that wraps the original function, such as @functools.cache. -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue47143> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28516] contextlib.ExitStack.__enter__ has trivial but undocumented behavior
Jelle Zijlstra added the comment: New changeset 1e3132b1c3ebff8d28a6dd353bf217cb97c41e81 by Miss Islington (bot) in branch '3.9': bpo-28516: document contextlib.ExitStack.__enter__ behavior (GH-31636) (GH-32145) https://github.com/python/cpython/commit/1e3132b1c3ebff8d28a6dd353bf217cb97c41e81 -- ___ Python tracker <https://bugs.python.org/issue28516> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28516] contextlib.ExitStack.__enter__ has trivial but undocumented behavior
Jelle Zijlstra added the comment: New changeset 86384cf83f96fcaec03e2ad6516e2e24f20d3b92 by vidhya in branch 'main': bpo-28516: document contextlib.ExitStack.__enter__ behavior (GH-31636) https://github.com/python/cpython/commit/86384cf83f96fcaec03e2ad6516e2e24f20d3b92 -- ___ Python tracker <https://bugs.python.org/issue28516> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43224] Add support for PEP 646
Jelle Zijlstra added the comment: New changeset e8e737bcf6d22927caebc30c5d57ac4634063219 by Matthew Rahtz in branch 'main': bpo-43224: Implement PEP 646 grammar changes (GH-31018) https://github.com/python/cpython/commit/e8e737bcf6d22927caebc30c5d57ac4634063219 -- ___ Python tracker <https://bugs.python.org/issue43224> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43224] Add support for PEP 646
Jelle Zijlstra added the comment: > 1. Finish writing docs (is updating library/typing.html sufficient? > https://github.com/python/cpython/pull/32103) We also need to add to the What's New for 3.11. I volunteered to do that for all the typing PEPs. > 2. Implement support for pickling of unpacked native tuples Linking your GH-32119 > 3. Implement support and add tests for copy() of TypeVarTuple and unpacked > tuple I believe this uses the same mechanism as pickling, so shouldn't need more work. -- ___ Python tracker <https://bugs.python.org/issue43224> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11339] annotation for class being defined
Jelle Zijlstra added the comment: Agree. typing.Self from PEP 673 fixes this specific case, and PEP 563 or 649 will provide a general solution. No need to keep this issue open. -- nosy: +JelleZijlstra status: pending -> open ___ Python tracker <https://bugs.python.org/issue11339> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46480] Implement typing.assert_type
Jelle Zijlstra added the comment: New changeset 3354245daf89ca2c760c2c3e5b69a571f25073ed by Shantanu in branch 'main': bpo-46480: rephrase typing.assert_type docs (GH-32069) https://github.com/python/cpython/commit/3354245daf89ca2c760c2c3e5b69a571f25073ed -- ___ Python tracker <https://bugs.python.org/issue46480> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46769] Improve documentation for `typing.TypeVar`
Jelle Zijlstra added the comment: Thanks Alex for the PR and Łukasz for merging the last backport! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46769> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38941] xml.etree.ElementTree.Element inconsistent warning for bool
Jelle Zijlstra added the comment: I was close to merging the linked PR but there's some renewed concerns about the proposed behavior here: Do we really want to change this behavior and potentially force a lot of people to change their working code? In addition, the current code emits FutureWarning. I don't really understand what that warning is supposed to be used for (https://docs.python.org/3/library/exceptions.html#FutureWarning), but at least it means we plan to change the behavior later. So we should have a plan for how we'll do that. And whatever we do, the Python and C versions of the code should behave consistently. Here are two ways forward: (1) We change both the Python and the C versions of ElementTree to emit a DeprecationWarning on using __bool__ in 3.11. In 3.13, we change the behavior to make __bool__ always return True. (Or perhaps, make it raise an exception.) (2) We give up on changing this behavior and remove the existing FutureWarning from the Python code. But in that case we should document the gotcha in the boolean behavior of nodes. I don't have enough experience with ElementTree to recommend either option, but I'm happy to help implement it once we come to a decision. -- nosy: +JelleZijlstra versions: +Python 3.11 -Python 3.9 ___ Python tracker <https://bugs.python.org/issue38941> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46769] Improve documentation for `typing.TypeVar`
Change by Jelle Zijlstra : -- pull_requests: +30156 pull_request: https://github.com/python/cpython/pull/32067 ___ Python tracker <https://bugs.python.org/issue46769> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46769] Improve documentation for `typing.TypeVar`
Jelle Zijlstra added the comment: New changeset d5ed8a8258eaf7a241978b1b0aeb971108d0f7e0 by Alex Waygood in branch '3.10': [3.10] bpo-46769: Improve documentation for `typing.TypeVar` (GH-31712) (GH-31941) https://github.com/python/cpython/commit/d5ed8a8258eaf7a241978b1b0aeb971108d0f7e0 -- ___ Python tracker <https://bugs.python.org/issue46769> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47088] Implement PEP 675 (LiteralString)
Change by Jelle Zijlstra : -- keywords: +patch pull_requests: +30155 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/32064 ___ Python tracker <https://bugs.python.org/issue47088> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47097] Document PEP 646
New submission from Jelle Zijlstra : https://docs.python.org/3.11/library/typing.html doesn't say anything about TypeVarTuple yet. -- assignee: docs@python components: Documentation messages: 415850 nosy: AlexWaygood, JelleZijlstra, docs@python, gvanrossum, kj, mrahtz priority: deferred blocker severity: normal stage: needs patch status: open title: Document PEP 646 versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue47097> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2604] doctest.DocTestCase fails when run repeatedly
Jelle Zijlstra added the comment: After 14 years this bug is finally fixed. Thanks everyone for the patches and discussion. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue2604> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2604] doctest.DocTestCase fails when run repeatedly
Jelle Zijlstra added the comment: New changeset 7ba7eae50803b11766421cb8aae1780058a57e2b by Daniël van Noord in branch 'main': bpo-2604: Make doctest.DocTestCase reset globs in teardown (GH-31932) https://github.com/python/cpython/commit/7ba7eae50803b11766421cb8aae1780058a57e2b -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue2604> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47087] Implement PEP 655 (Required/NotRequired)
Change by Jelle Zijlstra : -- components: +Library (Lib) stage: -> needs patch type: -> enhancement versions: +Python 3.11 ___ Python tracker <https://bugs.python.org/issue47087> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47088] Implement PEP 675 (LiteralString)
Change by Jelle Zijlstra : -- components: +Library (Lib) ___ Python tracker <https://bugs.python.org/issue47088> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47088] Implement PEP 675 (LiteralString)
New submission from Jelle Zijlstra : This one should be quite simple at runtime. I'll send a PR this week. -- assignee: JelleZijlstra messages: 415706 nosy: AlexWaygood, JelleZijlstra, gvanrossum, kj priority: normal severity: normal stage: needs patch status: open title: Implement PEP 675 (LiteralString) type: enhancement versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue47088> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47087] Implement PEP 655 (Required/NotRequired)
New submission from Jelle Zijlstra : PEP 655 was just accepted, so we should implement it in typing.py! We should be able to largely reuse the typing-extensions implementation. (I can't find David Foster on BPO but I'll point him to this issue.) -- messages: 415704 nosy: AlexWaygood, JelleZijlstra, gvanrossum, kj priority: normal severity: normal status: open title: Implement PEP 655 (Required/NotRequired) ___ Python tracker <https://bugs.python.org/issue47087> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47006] PEP 646: Decide on substitution behavior
Jelle Zijlstra added the comment: It's simple if you only look at simple examples. Here are some examples current main (with Serhiy's patch for the Python version of typing) gets wrong: >>> from typing import * >>> Ts = TypeVarTuple("Ts") >>> T1 = TypeVar("T1") >>> T2 = TypeVar("T2") >>> Tuple[T1, Unpack[Ts], T2][int, Unpack[tuple[int]]] # expect error typing.Tuple[int, *tuple[int]] >>> Tuple[T1, Unpack[Ts], str, T2][int, Unpack[Ts]] # expect error (T2 missing) typing.Tuple[int, str, *Ts] # it put *Ts in the wrong place >>> Tuple[T1, Unpack[Ts], str, T2][int, Unpack[Ts], Unpack[Ts]] # expect error >>> (*Ts can't substitute T2) typing.Tuple[int, *Ts, str, *Ts] >>> class G(Generic[T1, Unpack[Ts], T2]): pass ... >>> G[int] # expect error __main__.G[int] We can probably fix that, but I'm not looking forward to implementing the fixed logic in both Python and C. Also, I'm worried that it won't work with future extensions to the type system (e.g., the rumored Map operator) that may go into 3.12 or later versions. -- ___ Python tracker <https://bugs.python.org/issue47006> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43224] Add support for PEP 646
Jelle Zijlstra added the comment: New changeset 3a2b89580ded72262fbea0f7ad24096a90c42b9c by Jelle Zijlstra in branch 'main': bpo-43224: Add TypeVarTuple.__name__ (GH-31954) https://github.com/python/cpython/commit/3a2b89580ded72262fbea0f7ad24096a90c42b9c -- ___ Python tracker <https://bugs.python.org/issue43224> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46421] unittest ValueError when invoking as module
Change by Jelle Zijlstra : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46421> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46421] unittest ValueError when invoking as module
Jelle Zijlstra added the comment: New changeset 1cab44d8650ae3eece90b04fca373908205e7ee0 by Miss Islington (bot) in branch '3.9': [3.9] bpo-46421: Fix unittest filename evaluation when called as a module (GH-30654) (GH-31970) https://github.com/python/cpython/commit/1cab44d8650ae3eece90b04fca373908205e7ee0 -- ___ Python tracker <https://bugs.python.org/issue46421> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9736] doctest.DocTestSuite doesn't handle test globs correctly
Jelle Zijlstra added the comment: Yes. -- nosy: +JelleZijlstra resolution: -> duplicate stage: patch review -> resolved status: open -> closed superseder: -> doctest.DocTestCase fails when run repeatedly ___ Python tracker <https://bugs.python.org/issue9736> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42782] shutil.move creates a new directory even on failure
Change by Jelle Zijlstra : -- nosy: +JelleZijlstra nosy_count: 3.0 -> 4.0 pull_requests: +30061 pull_request: https://github.com/python/cpython/pull/31971 ___ Python tracker <https://bugs.python.org/issue42782> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40296] help(list[int]) fails
Change by Jelle Zijlstra : -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue40296> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46421] unittest ValueError when invoking as module
Jelle Zijlstra added the comment: New changeset a0db11b10fca0fee6bb2b8d6277e266bad8c0fdb by Bader Zaidan in branch 'main': bpo-46421: Fix unittest filename evaluation when called as a module (GH-30654) https://github.com/python/cpython/commit/a0db11b10fca0fee6bb2b8d6277e266bad8c0fdb -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue46421> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError
Change by Jelle Zijlstra : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46553> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44859] Improve some sqlite3 errors
Jelle Zijlstra added the comment: New changeset 4674fd4e938eb4a29ccd5b12c15455bd2a41c335 by Erlend Egeberg Aasland in branch 'main': bpo-44859: Raise more accurate exceptions in `sqlite3` (GH-27695) https://github.com/python/cpython/commit/4674fd4e938eb4a29ccd5b12c15455bd2a41c335 -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue44859> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43224] Add support for PEP 646
Change by Jelle Zijlstra : -- pull_requests: +30045 pull_request: https://github.com/python/cpython/pull/31954 ___ Python tracker <https://bugs.python.org/issue43224> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46480] Implement typing.assert_type
Change by Jelle Zijlstra : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46480> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46480] Implement typing.assert_type
Jelle Zijlstra added the comment: New changeset 96568e995d840c66edb25b6b9d85e4dcccf5a936 by Jelle Zijlstra in branch 'main': bpo-46480: add typing.assert_type (GH-30843) https://github.com/python/cpython/commit/96568e995d840c66edb25b6b9d85e4dcccf5a936 -- ___ Python tracker <https://bugs.python.org/issue46480> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22859] unittest.TestProgram.usageExit no longer invoked
Jelle Zijlstra added the comment: It is now marked deprecated, to be removed in 3.13. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue22859> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22859] unittest.TestProgram.usageExit no longer invoked
Jelle Zijlstra added the comment: New changeset 7c353b7594545fb9403b3123a17ad06cadc2f73d by Carlos Damazio in branch 'main': bpo-22859: deprecate unittest.main.TestProgram.usageExit (GH-30293) https://github.com/python/cpython/commit/7c353b7594545fb9403b3123a17ad06cadc2f73d -- ___ Python tracker <https://bugs.python.org/issue22859> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46769] Improve documentation for `typing.TypeVar`
Jelle Zijlstra added the comment: New changeset 81b425d4dc43b60dd11a3e9abc5c84a4b8b384db by Alex Waygood in branch 'main': bpo-46769: Improve documentation for `typing.TypeVar` (GH-31712) https://github.com/python/cpython/commit/81b425d4dc43b60dd11a3e9abc5c84a4b8b384db -- ___ Python tracker <https://bugs.python.org/issue46769> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47020] float('nan')==math.nan does NOT evaluate to True (as suggested by documentation).
Jelle Zijlstra added the comment: I'm guessing you're referring to https://docs.python.org/3.8/library/math.html#math.nan. The text says explicitly that math.nan is "equivalent" to float("nan"), not that it is equal. This is correct. nan is not equal to itself, because (for better or worse) that's what the IEEE standard requires. You can instead use math.isnan() to check whether a number is a nan. -- nosy: +JelleZijlstra ___ Python tracker <https://bugs.python.org/issue47020> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47006] PEP 646: Decide on substitution behavior
Jelle Zijlstra added the comment: Thanks Matthew! Merged PRs can still be reverted, and we have some time before the feature freeze. I'd like to hear what Guido and Ken think too. If we go with the GenericAlias substitution, we need to make sure that such aliases still work as base class. That would need some C work to make types.GenericAlias.__mro_entries__ recurse if the alias's origin is itself a GenericAlias. There's a few other subtleties to think about; I can work on that but don't have a ton of time today. -- ___ Python tracker <https://bugs.python.org/issue47006> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47006] PEP 646: Decide on substitution behavior
Change by Jelle Zijlstra : -- nosy: +mrahtz ___ Python tracker <https://bugs.python.org/issue47006> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47006] PEP 646: Decide on substitution behavior
New submission from Jelle Zijlstra : We've had some disagreement about the behavior of TypeVarTuple substitution related to PEP 646, and the discussion has now spilled around multiple PRs. I'd like to use this issue to come to an agreement so we don't have to chase through so many different places. Links: - GH-31021 (merged) implements PEP 646 in typing.py. Matthew initially implemented full TypeVar substitution support, but took it out after I suggested an alternative solution in https://github.com/python/cpython/pull/31021#pullrequestreview-890627941. - GH-31800 (merged without review) implements TypeVarTuple substitution in Python. - GH-31828 implements TypeVarTuple substitution in C. - GH-31844 and GH-31846 add additional test cases. - GH-31804 (closed) implements my proposed solution. I'd like to ask that until we come to an agreement we hold off on making any more changes, so we don't have to go back and forth and we ensure that the eventual solution covers all edge cases. The disagreement is about what to do with TypeVarTuple substitution: the behavior when a generic type is subscripted, like `tuple[*Ts][int, str]`. There are two possible extreme approaches: - Implement full substitution support, just as we have it for existing TypeVars. This is complicated because TypeVarTuple makes it much harder to match up the types correctly. However, it is consistent with the behavior for other TypeVar-like objects. My example would turn into GenericAlias(tuple, (int, str)). - Give up on substitution and just return a new GenericAlias object: GenericAlias(GenericAlias(tuple, Unpack[Ts]), (int, str). This avoids implementing any complex runtime behavior, but it inconsistent with existing behavior and less pretty when you print out the type. I prefer this approach because there's less risk that future enhancements to typing will break it. I also want to explore extending this approach to ParamSpec substitution. -- assignee: JelleZijlstra messages: 415100 nosy: JelleZijlstra, gvanrossum, kj, serhiy.storchaka priority: normal severity: normal status: open title: PEP 646: Decide on substitution behavior versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue47006> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46998] Allow subclassing Any at runtime
Change by Jelle Zijlstra : -- nosy: +AlexWaygood, gvanrossum, kj ___ Python tracker <https://bugs.python.org/issue46998> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46997] Invalid memory write in bytearray
Jelle Zijlstra added the comment: 3.9 segfaults. (gdb) bt #0 bytearray_ass_subscript (self=, index=0x77e118f0, values=0x76f918b0) at Objects/bytearrayobject.c:640 #1 0x00536302 in _PyEval_EvalFrameDefault (tstate=, f=0x999a80, throwflag=) at Python/ceval.c:1990 #2 0x00534775 in _PyEval_EvalFrame (throwflag=0, f=0x999a80, tstate=0x93de90) at ./Include/internal/pycore_ceval.h:40 -- versions: +Python 3.9 ___ Python tracker <https://bugs.python.org/issue46997> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46997] Invalid memory write in bytearray
Change by Jelle Zijlstra : -- components: +Interpreter Core versions: +Python 3.10, Python 3.11 ___ Python tracker <https://bugs.python.org/issue46997> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46997] Invalid memory write in bytearray
New submission from Jelle Zijlstra : Inspired by Guido's comment in https://github.com/python/cpython/pull/31834/files#r825352900, I found that there are some places in bytearrayobject.c where we can write to free'd memory if we encounter an object with a sneaky __index__ method: $ cat basneak.py ba = bytearray([0 for _ in range(1)]) class sneaky: def __index__(self): ba.clear() return 1 ba[-1] = sneaky() $ valgrind ./python basneak.py ==87894== Memcheck, a memory error detector ==87894== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==87894== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==87894== Command: ./python basneak.py ==87894== ==87894== Invalid write of size 1 ==87894==at 0x49B70F: bytearray_ass_subscript (bytearrayobject.c:632) ==87894==by 0x488E03: PyObject_SetItem (abstract.c:211) In bytearray_setitem(), we first do bounds checking, and then call _getbytevalue() to get the numeric value of the argument. I think there's a similar bug in bytearray_ass_subscript(). -- messages: 415021 nosy: JelleZijlstra, gvanrossum priority: normal severity: normal status: open title: Invalid memory write in bytearray ___ Python tracker <https://bugs.python.org/issue46997> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44799] typing.get_type_hints() raises TypeError for a variable annotated by dataclasses.InitVar
Change by Jelle Zijlstra : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue44799> ___ ___ 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
Jelle Zijlstra added the comment: This still behaves similarly after the bpo-46642 fix: >>> class V(TypeVar("T")): pass ... Traceback (most recent call last): File "", line 1, in File "/Users/jelle/py/cpython/Lib/typing.py", line 906, in __init__ self.__constraints__ = tuple(_type_check(t, msg) for t in constraints) ^^^ File "/Users/jelle/py/cpython/Lib/typing.py", line 906, in self.__constraints__ = tuple(_type_check(t, msg) for t in constraints) ^^^ File "/Users/jelle/py/cpython/Lib/typing.py", line 189, in _type_check raise TypeError(f"{msg} Got {arg!r:.100}.") ^^^ TypeError: TypeVar(name, constraint, ...): constraints must be types. Got (~T,). -- ___ 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
[issue44799] typing.get_type_hints() raises TypeError for a variable annotated by dataclasses.InitVar
Jelle Zijlstra added the comment: This is now fixed in main thanks to bpo-46644: ``` >>> get_type_hints(Foo) {'attr': dataclasses.InitVar[int]} ``` We're not backporting that change to the bugfix branches. If we want to fix this issue in 3.10 and 3.9, we'll have to add a `__call__` method to `InitVar`. My inclination is that that's not worth it. -- versions: -Python 3.8 ___ Python tracker <https://bugs.python.org/issue44799> ___ ___ 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
Change by Jelle Zijlstra : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ 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
Jelle Zijlstra added the comment: New changeset 75174371e6cac935b598a68c1113f6db1e0d6ed8 by Jelle Zijlstra in branch 'main': bpo-46644: Fix test_typing test broken by GH-31151 due to a merge race (GH-31833) https://github.com/python/cpython/commit/75174371e6cac935b598a68c1113f6db1e0d6ed8 -- ___ 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
Change by Jelle Zijlstra : -- pull_requests: +29930 stage: resolved -> patch review pull_request: https://github.com/python/cpython/pull/31833 ___ 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
Jelle Zijlstra added the comment: Some tests are failing on main, probably due to a race. PR incoming. -- resolution: fixed -> status: closed -> open ___ 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
[issue46677] TypedDict docs are incomplete
Jelle Zijlstra added the comment: Thanks @CharliieZhao for the improved documentation! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46677> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46677] TypedDict docs are incomplete
Jelle Zijlstra added the comment: New changeset b5140a5811aa35f4b488849fb55d84504732d135 by Charlie Zhao in branch '3.9': [3.9] bpo-46677: Add examples of inheritance and attributes to `TypedDict` docs. (GH-31349) (GH-31808) https://github.com/python/cpython/commit/b5140a5811aa35f4b488849fb55d84504732d135 -- ___ Python tracker <https://bugs.python.org/issue46677> ___ ___ 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
Jelle Zijlstra added the comment: Thanks for your contribution! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ 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