New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fused functions don't necessarily pass __Pyx_CyFunction_Check #3384
Labels
Milestone
Comments
Excellent analysis, thanks. The check function must use the correct (possibly imported) type pointer. |
I think the check function does use the correct type pointer. It's the creation of |
Ok, got it. We can change the base pointer after importing the type pointer and before initialising the fused function type. |
da-woods
added a commit
to da-woods/cython
that referenced
this issue
Mar 1, 2020
Issue cython#3384 This happened where Cython was using a shared API because the CyFunction type imported from the shared api wasn't the same as used to initialize the fused function tp_base
Closed in #3386 |
alexhenrie
pushed a commit
to alexhenrie/cython
that referenced
this issue
Mar 25, 2020
…honGH-3386) * Fixed issue where fused functions didn't register as cyfunctions Issue cython#3384 This happened where Cython was using a shared API because the CyFunction type imported from the shared api wasn't the same as used to initialize the fused function tp_base.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reproducible test-case:
Run this as part of the test-suite with a compiled version of Cython (fails) and a non-compiled version of Cython (passes).
I believe this issue is as follows
__pyx_FusedFunctionType_type
uses as its base__pyx_CyFunctionType_type
:https://github.com/cython/cython/blob/master/Cython/Utility/CythonFunction.c#L1408
__Pyx_CyFunction_Check
uses__pyx_CyFunctionType
(note lack of_type
suffix)cython/Cython/Utility/CythonFunction.c
Line 55 in cbedb54
__pyx_CyFunctionType
is initialized from using__Pyx_FetchCommonType
__pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
This means that when using a compiled version of Cython, it can end up different to
__pyx_CyFunctionType_type
, meaning fused functions no longer register as cyfunctions.Unfortunately I have no idea how this should be fixed....
For context (not really part of this bug report) this is causing me problems in
__Pyx_Method_ClassMethod
because it's deciding that fused functions are unknown types and throwing an exception. This is actually an easily-fixed bug in__Pyx_Method_ClassMethod
, which should follow the behaviour of the Pythonclassmethod
and accept any object then fail at runtime if it isn't callable.The text was updated successfully, but these errors were encountered: