[issue45359] TopologicalSorter is not Generic at runtime (but is in typeshed)
Alex Waygood added the comment: Another option for code using Python <3.11, that will work without the `from __future__ import annotations` import, is to do something like this: ``` from graphlib import TopologicalSorter x: 'TopologicalSorter[str]' = TopologicalSorter({"a": {}, "b": {"a"}}) ``` By using a string as the annotation, we give mypy the specificity it needs, but the expression will never need to be resolved at runtime. -- nosy: +AlexWaygood type: behavior -> enhancement ___ Python tracker <https://bugs.python.org/issue45359> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46032] functools' singledispatch does not support GenericAlias
Alex Waygood added the comment: My opinion is that supporting `GenericAlias` here would be a bad idea. Associating an implementation of the function with the argument type `list[str]` is ambiguous. Would this implementation be called if any argument of type `list` was supplied, or would it only be called if all elements in the list were of type `str`? The first option would be efficient, simple, and similar to the way singledispatch treats most other argument-types. However, it would be unintuitive. The second option would be more intuitive, but could be extremely inefficient if a very long list was passed in. It would also make the code more complicated. -- nosy: +AlexWaygood, lukasz.langa ___ Python tracker <https://bugs.python.org/issue46032> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46032] functools' singledispatch does not support GenericAlias
Alex Waygood added the comment: It would be well worth it to improve the error message, however: ``` >>> from functools import singledispatch >>> @singledispatch ... def func(arg): ... raise NotImplementedError ... >>> @func.register ... def _(arg: list[str]): ... print('Got a list of strings') ... >>> func(1) Traceback (most recent call last): File "/usr/local/lib/python3.9/functools.py", line 830, in dispatch impl = dispatch_cache[cls] File "/usr/local/lib/python3.9/weakref.py", line 405, in __getitem__ return self.data[ref(key)] KeyError: During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.9/functools.py", line 833, in dispatch impl = registry[cls] KeyError: During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.9/functools.py", line 877, in wrapper return dispatch(args[0].__class__)(*args, **kw) return dispatch(args[0].__class__)(*args, **kw) File "/usr/local/lib/python3.9/functools.py", line 835, in dispatch impl = _find_impl(cls, registry) File "/usr/local/lib/python3.9/functools.py", line 782, in _find_impl mro = _compose_mro(cls, registry.keys()) File "/usr/local/lib/python3.9/functools.py", line 743, in _compose_mro types = [n for n in types if is_related(n)] File "/usr/local/lib/python3.9/functools.py", line 743, in types = [n for n in types if is_related(n)] File "/usr/local/lib/python3.9/functools.py", line 742, in is_related and issubclass(cls, typ)) TypeError: issubclass() argument 2 cannot be a parameterized generic ``` -- ___ Python tracker <https://bugs.python.org/issue46032> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46032] functools' singledispatch does not support GenericAlias
Alex Waygood added the comment: The above traceback is because the `isinstance(list[str], type)` check at Lib/functools.py:848 evaluates to `True`. Related: #45665. -- ___ Python tracker <https://bugs.python.org/issue46032> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45665] Problems caused by isinstance(list[int], type) returning True
Alex Waygood added the comment: #46032 is related to this issue. -- nosy: +AlexWaygood ___ Python tracker <https://bugs.python.org/issue45665> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46014] functools.singledispatch does not support Union types
Alex Waygood added the comment: This is awesome! Should a note be added to the functools documentation mentioning the new feature? (Genuine question — I'm not sure whether it's necessary myself.) -- ___ Python tracker <https://bugs.python.org/issue46014> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46013] Confusing period in object.__hash__ doc
Change by Alex Waygood : -- nosy: +AlexWaygood ___ Python tracker <https://bugs.python.org/issue46013> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46032] functools' singledispatch does not support GenericAlias
Alex Waygood added the comment: The PR looks good to me. I think it's also important that we document that these types aren't supported, as it's not mentioned anywhere at the moment. Related: Issue34498. -- nosy: +uriyyo ___ Python tracker <https://bugs.python.org/issue46032> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46032] functools' singledispatch does not support GenericAlias
Change by Alex Waygood : -- components: +Documentation type: enhancement -> behavior ___ Python tracker <https://bugs.python.org/issue46032> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45684] `functools.singledispatchmethod` does not define `__class_getitem__`
Alex Waygood added the comment: Closing this, as I don't think the use case I presented is strong enough, and there are ultimately more important things to worry about. -- resolution: -> not a bug stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue45684> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45840] Improve cross-references in the data model documentation
Change by Alex Waygood : -- pull_requests: +28298 stage: backport needed -> patch review pull_request: https://github.com/python/cpython/pull/30077 ___ Python tracker <https://bugs.python.org/issue45840> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45729] [doc] "history and license" link has wrong target
Change by Alex Waygood : -- nosy: -AlexWaygood ___ Python tracker <https://bugs.python.org/issue45729> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45985] AttributeError from @property inadvertantly flows into __getattr__
Change by Alex Waygood : -- versions: -Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue45985> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46059] Typo in match Statement example
Change by Alex Waygood : -- keywords: +patch nosy: +AlexWaygood nosy_count: 2.0 -> 3.0 pull_requests: +28300 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30079 ___ Python tracker <https://bugs.python.org/issue46059> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45840] Improve cross-references in the data model documentation
Change by Alex Waygood : -- pull_requests: +28302 pull_request: https://github.com/python/cpython/pull/30081 ___ Python tracker <https://bugs.python.org/issue45840> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45840] Improve cross-references in the data model documentation
Alex Waygood added the comment: Thanks, Serhiy! -- ___ Python tracker <https://bugs.python.org/issue45840> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46064] Permalinks to underscored documentation entries don't work.
Alex Waygood added the comment: I can't reproduce this -- the permalink to __debug__ that I get is the same as the one you have posted here, and works fine for me on my laptop, phone and iPad. -- nosy: +AlexWaygood ___ Python tracker <https://bugs.python.org/issue46064> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46059] Typo in match Statement example
Change by Alex Waygood : -- type: -> behavior versions: +Python 3.11 ___ Python tracker <https://bugs.python.org/issue46059> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46066] [doc] TypedDict alternative definition syntax with keyword args is confusing
Change by Alex Waygood : -- nosy: +gvanrossum, kj ___ Python tracker <https://bugs.python.org/issue46066> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46059] Typo in match Statement example
Alex Waygood added the comment: Thanks for the bug report, Vivek! It should be fixed now -- it might take a day or two for the online docs to update. -- ___ Python tracker <https://bugs.python.org/issue46059> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25864] collections.abc.Mapping should include a __reversed__ that raises TypeError
Alex Waygood added the comment: The proposed patch appears to have been implemented in https://github.com/python/cpython/commit/97c1adf3935234da716d3289b85f72dcd67e90c2, and there has been no discussion for five years. I think this can now be closed. -- nosy: +AlexWaygood resolution: -> fixed stage: patch review -> resolved status: open -> pending ___ Python tracker <https://bugs.python.org/issue25864> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46076] Document using __slots__ to provide per-attribute docstrings
New submission from Alex Waygood : The ability to add docstrings for individual attributes, by using a dictionary for __slots__ was added in Issue36326. This is a fantastic feature, and deserves better documentation. It appears to currently only be documented in the "What's New" entry for Python 3.8: https://docs.python.org/3/whatsnew/3.8.html#inspect. Moreover, the data model documentation currently states the following regarding using a mapping to specify __slots__: """ Any non-string iterable may be assigned to __slots__. Mappings may also be used; however, in the future, special meaning may be assigned to the values corresponding to each key. """ This is arguably now incorrect. A special meaning has been assigned to the values corresponding to each key: the values can be used for per-attribute docstrings. -- assignee: docs@python components: Documentation messages: 408573 nosy: AlexWaygood, docs@python, rhettinger priority: normal severity: normal status: open title: Document using __slots__ to provide per-attribute docstrings type: enhancement versions: Python 3.10, Python 3.11, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46076> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46076] Document using __slots__ to provide per-attribute docstrings
Change by Alex Waygood : -- keywords: +patch pull_requests: +28332 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30109 ___ Python tracker <https://bugs.python.org/issue46076> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46079] [doc] Broken URL in "Brief Tour of the Standard Library"
Change by Alex Waygood : -- title: Broken URL in tutorial -> [doc] Broken URL in "Brief Tour of the Standard Library" type: -> behavior versions: +Python 3.11, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46079> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46081] Document the msg argument for assertRaises
Change by Alex Waygood : -- versions: -Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue46081> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46082] type casting of bool
Alex Waygood added the comment: Hi! Your message here is a little unclear. Are you proposing a new feature (an enhancement), or filing a bug report? In either case, I'm afraid this behavior is very unlikely to change. In general, strings in Python are always considered truthy unless they are empty, even if they are the literal string "False" or "0". This is a very important principle in Python, and changing it would raise serious backwards-compatibility concerns. You can read more about truth-value testing here: https://docs.python.org/3/library/stdtypes.html#truth-value-testing -- components: -2to3 (2.x to 3.x conversion tool) nosy: +AlexWaygood status: open -> pending type: enhancement -> ___ Python tracker <https://bugs.python.org/issue46082> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46085] OrderedDict iterator allocates di_result unnecessarily
Change by Alex Waygood : -- nosy: +rhettinger versions: -Python 3.8 ___ Python tracker <https://bugs.python.org/issue46085> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46086] Add ratio_min() function to the difflib library
Alex Waygood added the comment: I am removing 3.10 from the "versions" field, since additions to the standard library are only considered for unreleased versions of Python. -- nosy: +AlexWaygood, tim.peters versions: -Python 3.10 ___ Python tracker <https://bugs.python.org/issue46086> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46086] Add ratio_min() function to the difflib library
Change by Alex Waygood : -- nosy: -AlexWaygood ___ Python tracker <https://bugs.python.org/issue46086> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46092] Fix/update missing parameters in function signatures for Built-in Functions documentation.
Change by Alex Waygood : -- nosy: +AlexWaygood versions: +Python 3.11, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46092> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46092] Fix/update missing parameters in function signatures for Built-in Functions documentation.
Alex Waygood added the comment: It concerns me that help() gives very different results for some of these functions than the signature you'll find in the documentation. I think a beginner would find that highly confusing. If the view is that the slash notation should not be added to this piece of documentation, since it is aimed at beginners, should help() be changed so that it does not include the slash notation for built-in functions? -- ___ Python tracker <https://bugs.python.org/issue46092> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46104] Reduce use of old-style syntax in typing docs
New submission from Alex Waygood : There are a few places in the typing docs where old-style (pre-PEP 526) syntax is used in examples. It doesn't look like these examples have been updated since 2016; it would be good to change them so that they use the newer syntax introduced in PEP 526. -- assignee: docs@python components: Documentation messages: 408721 nosy: AlexWaygood, docs@python, gvanrossum, kj priority: normal severity: normal status: open title: Reduce use of old-style syntax in typing docs type: enhancement versions: Python 3.10, Python 3.11, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46104> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46104] Reduce use of old-style syntax in typing docs
Change by Alex Waygood : -- keywords: +patch pull_requests: +28368 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30148 ___ Python tracker <https://bugs.python.org/issue46104> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46104] Reduce use of old-style syntax in typing docs
Change by Alex Waygood : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46104> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37578] Change Glob: Allow Recursion for Hidden Files
Change by Alex Waygood : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.11 -Python 3.9 ___ Python tracker <https://bugs.python.org/issue37578> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46099] Solaris: Fix pthread_getcpuclockid test
Change by Alex Waygood : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed type: -> behavior ___ Python tracker <https://bugs.python.org/issue46099> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31914] Document Pool.(star)map return type
Alex Waygood added the comment: This appears to have been fixed in PR 26560 in the main branch, but it might be nice to backport it to 3.10 and 3.9 -- nosy: +AlexWaygood, mdk stage: -> backport needed type: enhancement -> behavior versions: +Python 3.10, Python 3.9 -Python 3.6 ___ Python tracker <https://bugs.python.org/issue31914> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34643] How to build Release Version of Python in Windows?
Alex Waygood added the comment: Given that there has been no activity on this issue for over three years, I am closing this as "rejected". -- nosy: +AlexWaygood resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue34643> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31914] Document Pool.(star)map return type
Alex Waygood added the comment: PR 30191 and PR 30192 are backports -- ___ Python tracker <https://bugs.python.org/issue31914> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33567] Explicitly mention bytes and other buffers in the documentation for float()
Change by Alex Waygood : -- assignee: -> docs@python components: +Documentation nosy: +docs@python stage: -> needs patch type: -> enhancement versions: +Python 3.10, Python 3.11, Python 3.9 ___ Python tracker <https://bugs.python.org/issue33567> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33449] Documentation for email.charset confusing about the location of constants
Change by Alex Waygood : -- versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue33449> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46130] Untranslatable link text in whatsnew/3.10
Change by Alex Waygood : -- nosy: +mdk type: -> behavior ___ Python tracker <https://bugs.python.org/issue46130> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46132] Attempting to create an enum with slots silently fails
New submission from Alex Waygood : Attempting to create an enum with __slots__ silently fails. No error is raised if __slots__ are specified, but the usual behaviour of __slots__ does not work as expected. Attributes that are not specified in __slots__ can be freely set: >>> from enum import Enum >>> class Color(Enum): ... __slots__ = () ... RED = 0 ... BLUE = 1 ... >>> Color.RED.foo = 'bar' >>> Given that enums are rather special, I didn't exactly *expect* this to work -- but it might be good to raise some kind of error if a user attempts to specify __slots__, instead of having it fail silently. -- messages: 408898 nosy: AlexWaygood, ethan.furman priority: normal severity: normal status: open title: Attempting to create an enum with slots silently fails type: behavior versions: Python 3.10, Python 3.11, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46132> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46104] Reduce use of old-style syntax in typing docs
Change by Alex Waygood : -- pull_requests: +28424 pull_request: https://github.com/python/cpython/pull/30203 ___ Python tracker <https://bugs.python.org/issue46104> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46104] Reduce use of old-style syntax in typing docs
Change by Alex Waygood : -- resolution: fixed -> stage: resolved -> patch review status: closed -> open ___ Python tracker <https://bugs.python.org/issue46104> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29971] threading.Lock.acquire() not interruptible on Windows
Change by Alex Waygood : -- stage: -> needs patch versions: +Python 3.11 -Python 3.8 ___ Python tracker <https://bugs.python.org/issue29971> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10789] Lock.acquire documentation is misleading
Alex Waygood added the comment: I am closing this issue. The original topic of discussion (Lock.acquire documentation) has been resolved, and there were other issues opened to discuss the more general issue. There has also been no real activity in this issue thread for a decade. -- dependencies: -Document lack of support for keyword arguments in C functions nosy: +AlexWaygood resolution: -> fixed stage: needs patch -> resolved status: open -> closed type: -> behavior ___ Python tracker <https://bugs.python.org/issue10789> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29328] struct module should support variable-length strings
Alex Waygood added the comment: I am closing this issue as "rejected", given the consensus that writing a patch could be a major undertaking, the lack of such a patch, and the fact that there has been no activity on the issue thread (or the python-ideas mailing list) for nearly 5 years. -- nosy: +AlexWaygood resolution: -> rejected stage: needs patch -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue29328> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46134] Confusing error message for AttributeError with dataclasses
Alex Waygood added the comment: Thanks for the bug report, Landon! I think I can reproduce this with a slightly shorter code snippet, but I don't think this is a bug: ``` >>> from dataclasses import dataclass, field >>> @dataclass ... class Character: ... sort_index: int = field(init=False, repr=False) ... intelligence: int ... def __post_init__(self): ... self.sortindex = self.intelligence ... >>> c = Character(intelligence=50) >>> c Character(intelligence=50) >>> c.sortindex 50 >>> c.sort_index AttributeError: 'Character' object has no attribute 'sort_index'. Did you mean: 'sortindex'? ``` This seems like the correct error message to me. The issue is that your "Character" class has a field named "sort_index", but that field is never assigned to. Instead, you assign an attribute named "sortindex" in your __post_init__ method. So the error message is correct: an instance of your Character class has no attribute "sort_index" (it only has a field named "sort_index"), but it *does* have an attribute "sortindex". -- nosy: +AlexWaygood, eric.smith status: open -> pending title: Dataclass Suggestion reversed: sortindex / sort_index -> Confusing error message for AttributeError with dataclasses ___ Python tracker <https://bugs.python.org/issue46134> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46076] Document using __slots__ to provide per-attribute docstrings
Alex Waygood added the comment: Thanks for taking the time to review and merge :) -- ___ Python tracker <https://bugs.python.org/issue46076> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46132] Consider adding __slots__ to enums?
Alex Waygood added the comment: Ah, of course, I'm an idiot — I forgot that a class could not prevent the creation of __dict__ unless the parent class also had __slots__. Thanks, Christian. In which case: consider this a feature request to consider adding __slots__ to enum.Enum: for faster attribute access, lower memory footprint, and the ability to define __slots__ in custom Enum classes. -- title: Attempting to create an enum with slots silently fails -> Consider adding __slots__ to enums? type: behavior -> enhancement versions: -Python 3.10, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46132> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46104] Reduce use of old-style syntax in typing docs
Change by Alex Waygood : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46104> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43424] Document the `controller.name` field in `webbrowser` module
Change by Alex Waygood : -- type: security -> enhancement versions: +Python 3.11 -Python 3.10 ___ Python tracker <https://bugs.python.org/issue43424> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46172] [doc] Outdated description of `license` object
Change by Alex Waygood : -- type: -> behavior ___ Python tracker <https://bugs.python.org/issue46172> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46162] Make `builtins.property` generic
Change by Alex Waygood : -- nosy: +AlexWaygood ___ Python tracker <https://bugs.python.org/issue46162> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4079] urllib.request.Request 'timeout' attribute needs to have a default
Change by Alex Waygood : -- title: urllib.requst.Request 'timeout' attribute needs to have a default -> urllib.request.Request 'timeout' attribute needs to have a default ___ Python tracker <https://bugs.python.org/issue4079> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31914] Document Pool.(star)map return type
Change by Alex Waygood : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue31914> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46170] Improving the error message when subclassing NewType
Change by Alex Waygood : -- nosy: +AlexWaygood ___ Python tracker <https://bugs.python.org/issue46170> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18677] Enhanced context managers with ContextManagerExit and None
Alex Waygood added the comment: Given that this issue has seen no activity for eight years, I am closing it as "rejected". -- nosy: +AlexWaygood resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue18677> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30420] Clarify kwarg handing for subprocess convenience APIs
Alex Waygood added the comment: The modern docs for these functions seem to: * Document the cwd argument for these functions, following PR 1685 & PR 2253. * Include an **other_popen_kwargs parameter for all these functions. Nick, is there anything left to do here, or can this issue be closed now? -- nosy: +AlexWaygood ___ Python tracker <https://bugs.python.org/issue30420> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34498] Python 3.7+ break on singledispatch_function.register(pseudo_type), which Python 3.6 accepted
Alex Waygood added the comment: Guido: Serhiy fixed this very recently in Issue46032. The documentation should probably be improved, however, in my opinion; there's currently nothing officially stating that GenericAlias/NewType/typing aliases are unsupported. Support for singledispatch.register(union_type) was also recently added in Issue46014, but has yet to be documented. -- ___ Python tracker <https://bugs.python.org/issue34498> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46191] Conflict between using annotations in singledispatch() and MyPy
Change by Alex Waygood : -- nosy: +AlexWaygood, lukasz.langa ___ Python tracker <https://bugs.python.org/issue46191> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46120] Add note to `typing.Union` that it is recommended to use `|` instead
Change by Alex Waygood : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46120> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30420] [doc] subprocess module: Clarify kwarg handing for convenience APIs
Change by Alex Waygood : -- title: Clarify kwarg handing for subprocess convenience APIs -> [doc] subprocess module: Clarify kwarg handing for convenience APIs ___ Python tracker <https://bugs.python.org/issue30420> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38397] __init_subclass__ causes TypeError when used with more standard library metaclasses (such as EnumMeta)
Alex Waygood added the comment: I am closing this, as I believe it was fixed by the addition of **kwds to EnumMeta. Feel free to reopen this if you disagree, @retnikt. -- nosy: +AlexWaygood resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue38397> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46191] Conflict between using annotations in singledispatch() and MyPy
Alex Waygood added the comment: I like Serhiy's idea from a type-checking perspective. It would mean we could continue to have sophisticated type inference from mypy/pyright/etc. inside singledispatch function definitions. It would also mean people could use type annotations in singledispatch functions in much the same way as in the rest of their code, instead of having to remember that *this specific stdlib function* works differently. Lastly, it avoids having to have each type-checker separately special-case singledispatch so that they do not raise an error when an unparameterised generic is used as a type annotation. My concern, however, is that the runtime semantics are slightly unintuitive. Registering an implementation to the "type" `list[str]` (and having it succeed without an error being raised) might give the false implication that there will be runtime checking of whether all the elements in a list are strings. I also think that GenericAlias objects should probably only be accepted in the form of `singledispatch.register()` that parses type annotations. There's no use case for allowing GenericAlias objects in the other forms of registering implementations. -- ___ Python tracker <https://bugs.python.org/issue46191> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46191] Conflict between using annotations in singledispatch() and MyPy
Alex Waygood added the comment: Yeah, I think I agree with Guido. Mypy only has partial support for singledispatch anyway, and only achieves that through a plugin, so special-casing by type-checkers is inevitable. -- ___ Python tracker <https://bugs.python.org/issue46191> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46014] functools.singledispatch does not support Union types
Alex Waygood added the comment: ``` >>> from typing import Optional, get_origin >>> get_origin(Optional[int]) typing.Union ``` ^Because of that, it will work with typing.Optional as well as typing.Union and types.UnionType, yes. I am planning on submitting a docs PR at some point in the next few days (probably linked to a new BPO issue). -- ___ Python tracker <https://bugs.python.org/issue46014> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46224] doc: Fix bisect example using mutable function default
Change by Alex Waygood : -- keywords: +patch stage: -> patch review versions: -Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue46224> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46244] typing._TypeVarLike missing __slots__
Change by Alex Waygood : -- nosy: +gvanrossum, kj ___ Python tracker <https://bugs.python.org/issue46244> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46242] Improve error message when attempting to extend an enum with `__call__`
Change by Alex Waygood : -- title: Improve error message when creating an enum with `__call__` -> Improve error message when attempting to extend an enum with `__call__` ___ Python tracker <https://bugs.python.org/issue46242> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46246] importlib.metadata.DeprecatedList appears to be missing __slots__
Change by Alex Waygood : -- nosy: +jaraco ___ Python tracker <https://bugs.python.org/issue46246> ___ ___ 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 Alex Waygood : -- nosy: +gvanrossum, kj ___ 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
[issue20369] concurrent.futures.wait() blocks forever when given duplicate Futures
Change by Alex Waygood : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue20369> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45665] Problems caused by isinstance(list[int], type) returning True
Alex Waygood added the comment: `isinstance(list[int], type)` returns `True` in 3.9 as well, so the behaviour has been around for a while. (Not a comment on whether the change is worth making, just a note.) -- ___ Python tracker <https://bugs.python.org/issue45665> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45665] Problems caused by isinstance(list[int], type) returning True
Alex Waygood added the comment: Yes, there are a few exceptions to that :( ``` >>> from typing import Annotated >>> x = Annotated[int, "idk some int"] >>> x() 0 >>> isinstance(x, type) False >>> >>> from re import Pattern >>> y = Pattern[str] >>> y() Traceback (most recent call last): File "", line 1, in TypeError: cannot create 're.Pattern' instances >>> isinstance(y, type) True ``` -- ___ Python tracker <https://bugs.python.org/issue45665> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45665] Problems caused by isinstance(list[int], type) returning True
Alex Waygood added the comment: I agree with Serhiy. -- ___ Python tracker <https://bugs.python.org/issue45665> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46262] Enum tests: Error path in `_missing_()` is not covered for `Flag` and `IntFlag`
Change by Alex Waygood : -- title: Error path in `_missing_()` is not covered for `enum.Flag` and `enum.IntFlag` -> Enum tests: Error path in `_missing_()` is not covered for `Flag` and `IntFlag` ___ Python tracker <https://bugs.python.org/issue46262> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46269] '__new__' is never shown in `dir(SomeEnum)`
Alex Waygood added the comment: Thanks, Nikita! My bad for not adding tests for __new__ in PR 29316. To confirm: yes, my idea in PR 29316 was that "__new__" (along with most enum dunders) should not show up in the output of dir(Enum), but should show up in dir(EnumSubclass) if and only if __new__ has been overridden outside of enum.py. That's because, unlike with most Python classes, the fact that enum.Enum has a __new__ method or a __format__ method doesn't really tell you very much about enum.Enum's behaviour, due to how magical enums are. But if it's been overridden in a custom Enum subclass, that does tell you that the enum class has special behaviour in some way — the HTTPStatus enum at Lib/http/__init__.py:6 is a really good example of that. But you're right: the existing code doesn't work as expected, at all: ``` >>> from http import HTTPStatus >>> '__new__' in dir(HTTPStatus) False ``` -- ___ Python tracker <https://bugs.python.org/issue46269> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46244] typing._TypeVarLike missing __slots__
Change by Alex Waygood : -- nosy: +AlexWaygood ___ Python tracker <https://bugs.python.org/issue46244> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45665] Problems caused by isinstance(list[int], type) returning True
Alex Waygood added the comment: > We will still allow instantiating e.g. list[int], right? I certainly hope so! That would be a much more breaking change if we were to change that, and I can't personally see any benefit to doing so. -- ___ Python tracker <https://bugs.python.org/issue45665> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46290] Parameter names are inaccurate in dataclasses docs
Change by Alex Waygood : -- nosy: +eric.smith type: -> behavior ___ Python tracker <https://bugs.python.org/issue46290> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46301] Enum tests: One branch is not covered in `Enum._convert_`
Change by Alex Waygood : -- nosy: +ethan.furman title: One branch is not covered in `Enum._convert_` -> Enum tests: One branch is not covered in `Enum._convert_` ___ Python tracker <https://bugs.python.org/issue46301> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46242] Improve error message when attempting to extend an enum with `__call__`
Change by Alex Waygood : -- assignee: -> ethan.furman ___ Python tracker <https://bugs.python.org/issue46242> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46306] Suspicious operation in `doctest.py`: `None - 1`
Change by Alex Waygood : -- title: Suspicios operation in `doctest.py`: `None - 1` -> Suspicious operation in `doctest.py`: `None - 1` ___ Python tracker <https://bugs.python.org/issue46306> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46319] datetime.utcnow() should return a timezone aware datetime
Change by Alex Waygood : -- nosy: +belopolsky, p-ganssle versions: -Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue46319> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43698] Use syntactically correct examples on abc package page
Change by Alex Waygood : -- stage: -> patch review type: compile error -> behavior ___ Python tracker <https://bugs.python.org/issue43698> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46327] `test_enum` contains tests for older versions of python
Change by Alex Waygood : -- assignee: -> ethan.furman ___ Python tracker <https://bugs.python.org/issue46327> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46334] Glossary URLs with anchor link no longer jump to definitions
Alex Waygood added the comment: Reproduced on safari on my iPad, as well. -- nosy: +AlexWaygood ___ Python tracker <https://bugs.python.org/issue46334> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46333] ForwardRef.__eq__ does not respect module parameter
Change by Alex Waygood : -- nosy: +AlexWaygood ___ Python tracker <https://bugs.python.org/issue46333> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46330] Simplify the signature of __exit__
Change by Alex Waygood : -- nosy: +AlexWaygood ___ Python tracker <https://bugs.python.org/issue46330> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46328] add sys.exception()
Change by Alex Waygood : -- nosy: +AlexWaygood ___ Python tracker <https://bugs.python.org/issue46328> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46244] typing._TypeVarLike missing __slots__
Change by Alex Waygood : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed type: performance -> behavior ___ Python tracker <https://bugs.python.org/issue46244> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41987] singledispatchmethod raises an error when relying on a forward declaration
Change by Alex Waygood : -- nosy: +AlexWaygood, lukasz.langa ___ Python tracker <https://bugs.python.org/issue41987> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46342] Make @final introspectable at runtime
Change by Alex Waygood : -- nosy: +AlexWaygood ___ Python tracker <https://bugs.python.org/issue46342> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46309] Task created by StreamReaderProtocol gets garbage collected.
Alex Waygood added the comment: I'm removing 3.7 and 3.8 from the "versions" field, since those branches are old enough that they're now only accepting security-related patches. -- nosy: +AlexWaygood versions: -Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue46309> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46309] Task created by StreamReaderProtocol gets garbage collected.
Change by Alex Waygood : -- nosy: -AlexWaygood ___ Python tracker <https://bugs.python.org/issue46309> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46348] Modernize `test_typing`
Change by Alex Waygood : -- nosy: +AlexWaygood, gvanrossum, kj title: Morernize `test_typing` -> Modernize `test_typing` type: -> behavior ___ Python tracker <https://bugs.python.org/issue46348> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46348] Modernize `test_typing`
Alex Waygood added the comment: Heh, no worries! -- ___ Python tracker <https://bugs.python.org/issue46348> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46354] AttributeError: module 'collections' has no attribute 'Mapping'
New submission from Alex Waygood : Hi -- thanks for the report! You haven't given us many details here, but I think this is intentional behaviour, not a bug -- this was changed in Issue37324. Importing `Mapping` (along with many other names) directly from `collections`, instead of from `collections.abc`, has been deprecated since Python 3.3, and was removed in Python 3.10. So instead of writing `from collections import Mapping`, simply write `from collections.abc import Mapping`, and you should find that no error is raised. -- nosy: +AlexWaygood resolution: -> not a bug status: open -> pending ___ Python tracker <https://bugs.python.org/issue46354> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com