You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
types.GenericAlias has extra __copy__ and __deepcopy__ in __dir__ #105487
>>> type A[X] =list[X]
>>>dir(A[int])
[..., '__copy__', '__deepcopy__', ...]
We can access all other attributes, but not __copy__ and __deepcopy__:
>>> A[int].__copy__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>AttributeError: 'types.GenericAlias' object has no attribute '__copy__'. Did you mean: '__doc__'?
>>> A[int].__deepcopy__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>AttributeError: 'types.GenericAlias' object has no attribute '__deepcopy__'
I am not quite sure what is the right thing to do here 🤔
Activity
pythongh-105487: Change the `repr` of `ParamSpec` list of args in `Ge…
hugovk commentedon Nov 10, 2023
Thanks for the fix!
asottile-sentry commentedon Sep 5, 2025
a little late to the party but
__bases__appears to not work as well:pythongh-105487: Fix `__dir__` entries of `GenericAlias`
sobolevn commentedon Sep 6, 2025
Looks like the linked PR does something completely different. I created a new one.
sobolevn commentedon Sep 6, 2025
Thanks for the report!
pythongh-105487: Fix `__dir__` entries of `GenericAlias`
gh-105487: Fix `__dir__` entries of `GenericAlias` (#138578)
pythongh-105487: Fix `__dir__` entries of `GenericAlias` (pythonGH-13…
[3.13] pythongh-105487: Fix `__dir__` entries of `GenericAlias` (pyth…
[3.13] gh-105487: Fix `__dir__` entries of `GenericAlias` (GH-138578) (…
pythongh-105487: Fix `__dir__` entries of `GenericAlias` (python#138578)
[3.14] gh-105487: Fix `__dir__` entries of `GenericAlias` (GH-138578) (…