[issue27984] singledispatch register should typecheck its argument

Nick Coghlan report at bugs.python.org
Tue Sep 6 22:22:04 EDT 2016


Nick Coghlan added the comment:

Catching the erroneous registration rather than silently ignoring it sounds like the right thing to do here to me as well.

I'm actually surprised that code isn't already throwing an exception later on, as "isinstance" itself does fail with non-types:

>>> from enum import Enum
>>> 
>>> IS = Enum("IS", "a, b")
>>> isinstance(IS.a, IS)
True
>>> isinstance(IS.a, IS.a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: isinstance() arg 2 must be a type or tuple of types

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27984>
_______________________________________


More information about the Python-bugs-list mailing list