Skip to content

bpo-27984: explictly check type of singledispatch.dispatch() argument#6114

Closed
zhangyangyu wants to merge 1 commit into
python:masterfrom
zhangyangyu:issue27984
Closed

bpo-27984: explictly check type of singledispatch.dispatch() argument#6114
zhangyangyu wants to merge 1 commit into
python:masterfrom
zhangyangyu:issue27984

Conversation

@zhangyangyu

@zhangyangyu zhangyangyu commented Mar 14, 2018

Copy link
Copy Markdown
Member

@zhangyangyu

Copy link
Copy Markdown
Member Author

backport to 3.6: #6115

@ambv

ambv commented Mar 14, 2018

Copy link
Copy Markdown
Contributor

As commented on the BPO issue: the problem described in this issue is fixed, by BPO-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 straight to dispatch().

@ambv ambv closed this Mar 14, 2018
@zhangyangyu zhangyangyu deleted the issue27984 branch March 14, 2018 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants