[issue27984] singledispatch register should typecheck its argument

Łukasz Langa report at bugs.python.org
Wed Mar 14 18:23:48 EDT 2018


Łukasz Langa <lukasz at langa.pl> added the comment:

I'm sorry that you wasted your time on those pull requests, Xiang but:
- we cannot accept any new features for 3.6 and 3.7 anymore;
- the problem described in this issue is fixed, as you noticed yourself, by #32227.

The wrapper returned by the `@register` decorator is calling `dispatch()` with the first argument's `__class__`. It can only ever be invalid if somebody deliberately wrote something invalid to the object's `__class__`. It's extremely unlikely.

We should not slow down *calling* of all generic functions on the basis that somebody might pass a non-type straigh to `dispatch()`.

Cheryl, thanks for your help triaging the bug tracker! It might be a good idea to confirm with people on old issues whether moving the patch to a pull request is indeed the missing part of it getting merged. In this case it wasn't, I hope Xiang won't feel bad about me rejecting his pull requests after you pinged him for them.

----------
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> singledispatch support for type annotations

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


More information about the Python-bugs-list mailing list