-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
reprod:
from astropy.io.fits.util import itersubclasses
list(itersubclasses(object))Traceback (most recent call last):
File "<python-input-1>", line 2, in <module>
list(itersubclasses(object))
~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "<...>/.venv/lib/python3.14/site-packages/astropy/io/fits/util.py", line 187, in itersubclasses
if sub not in _seen:
^^^^^^^^^^^^^^^^
TypeError: cannot use 'typing._UnionGenericAliasMeta' as a set element (unhashable type: '_UnionGenericAliasMeta')typing._UnionGenericAliasMeta is a private implementation detail from the standard library. It's furthermore mentioned on the What's New page as follow
Previously, old-style unions were implemented using the private class
typing._UnionGenericAlias. This class is no longer needed for the implementation, but it has been retained for backward compatibility, with removal scheduled for Python 3.17. Users should use documented introspection helpers like typing.get_origin() and typing.get_args() instead of relying on private implementation details
We could probably just special-case it as a last resort, but it's still pretty surprising that the class itself became unhashable all of a sudden, so I'll also report upstream so CPython folks have a chance of fixing this in time for the final release if they think it's appropriate.