isinstance(obj, Hashable)
raises TypeError
when both obj
and type(obj)
are unhashable
#129589
Labels
isinstance(obj, Hashable)
raises TypeError
when both obj
and type(obj)
are unhashable
#129589
Bug report
Bug description:
Assumption:
isinstance(anything, any_type)
should never raise.The problem appears to be in
_abc.c
function_abc__abc_subclasscheck_impl
(known at runtime as_abc._abc_subclasscheck()
), which reads (in part):The implementation assumes
subclass
is hashable. That's almost always true of classes, but not guaranteed.Reproduction case:
Traceback for (cpython) Python 3.13.1:
Tracebacks are nearly identical with Python 3.8, 3.9, 3.10, 3.11, and 3.12, as well as Python 3.14.0a4.
CPython versions tested on:
3.13, 3.12, 3.11, 3.10, 3.9, 3.14
Operating systems tested on:
macOS
The text was updated successfully, but these errors were encountered: