Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-34838: Perform a more easily branch-predictable type check#9659

Merged
serhiy-storchaka merged 1 commit into
python:masterpython/cpython:masterfrom
ammaraskar:argument_clinic_subtypeammaraskar/cpython:argument_clinic_subtypeCopy head branch name to clipboard
Jan 12, 2019
Merged

bpo-34838: Perform a more easily branch-predictable type check#9659
serhiy-storchaka merged 1 commit into
python:masterpython/cpython:masterfrom
ammaraskar:argument_clinic_subtypeammaraskar/cpython:argument_clinic_subtypeCopy head branch name to clipboard

Conversation

@ammaraskar

@ammaraskar ammaraskar commented Oct 1, 2018

Copy link
Copy Markdown
Member

More details available on the bpo page.

https://bugs.python.org/issue34838

Comment thread Tools/clinic/clinic.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only tuple and dict? Same fast path would apply to all types with fast subclass flags from object.h (

/* These flags are used to determine if a type is a subclass. */
), including int, list, bytes, str, BaseException and type.

@MojoVampire MojoVampire Oct 3, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Admittedly, most things that accept int should probably accept anything convertable to int via __index__ even if it's not a direct subclass, but otherwise it seems like all the others should have the optimization available.

Argument clinic now generates fast inline code for
positional parsing, so the manually implemented type
check in math.dist can be removed.
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.

6 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.