-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up special handling of PyCFunction and CyFunction (GH-5739)
This avoids crashes in debug mode where CPython's access functions assert a type check (which fails for CyFunction). Avoid excluding CyFunction from the fast-call fast-paths for 0/1 args in Python debug mode. Also include the 1-arg (METH_O) case in the optimisation - I cannot see a reason why only 0-args should be special-cased for CyFunction. Fix a bug in __Pyx_TryUnpackUnboundCMethod() where we checked for "defined(CYTHON_COMPILING_IN_PYPY)" (which is always true) instead of the defined 0/1 value. It's probably ok to apply the unpacking of unbound methods to any PyCFunction, including subclasses. Due to a bug, we weren't doing the type check at all before, which meant that PyCFunction_GET_SELF() could actually fail and we'd ignore the error.
- Loading branch information
Showing
4 changed files
with
65 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters