[issue45359] TopologicalSorter is not Generic at runtime (but is in typeshed)

2021-12-10 Thread Jacob Hayes
Jacob Hayes added the comment: Thanks for the tips! I've been using this patch in my own code in a early imported `__init__.py`: ``` from graphlib import TopologicalSorter from types import GenericAlias if not hasattr(TopologicalSorter, "__class_getitem__"): # pragma

[issue45359] TopologicalSorter is not Generic at runtime (but is in typeshed)

2021-12-09 Thread Jacob Hayes
Jacob Hayes added the comment: Thanks for merging! Should typeshed be updated for <3.11 in the meantime or do you suggest `if TYPE_CHECKING` blocks on user side? Perhaps it's a non-issue if no one else has noticed this. :) -- ___ Python trac

[issue45359] TopologicalSorter is not Generic at runtime (but is in typeshed)

2021-10-03 Thread Jacob Hayes
Change by Jacob Hayes : -- keywords: +patch pull_requests: +27064 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28714 ___ Python tracker <https://bugs.python.org/issu

[issue45359] TopologicalSorter is not Generic at runtime (but is in typeshed)

2021-10-03 Thread Jacob Hayes
New submission from Jacob Hayes : Reproduction: ``` from graphlib import TopologicalSorter TopologicalSorter[str]({"a": {}, "b": {"a"}}) ``` ``` $ mypy /tmp/toposort.py Success: no issues found in 1 source file $ python3 /tmp/toposort.py Traceback (most r

[issue45167] deepcopy of GenericAlias with __deepcopy__ method is broken

2021-09-10 Thread Jacob Hayes
New submission from Jacob Hayes : When deepcopying a parametrized types.GenericAlias (eg: a dict subclass) that has a __deepcopy__ method, the copy module doesn't detect the GenericAlias as a type and instead tries to call cls.__deepcopy__, passing `memo` inplace of self. This doesn't seem