Repository navigation
Make GraalPy use cyfunction Limited API structure - #7971
Conversation
This avoids them having to write accessor functions to reach inside PyCFunctionObject.
|
This is my proposed replacement for the CyFunction bits of #7964. My claim is that it's better because it reduces the amount of It's only really for CPython where we benefit from using the same structure for our functions and Python C functions as an optimization for optimizations. The Limited API version has full functionality so they don't lose anything by using it. |
scoder
left a comment
There was a problem hiding this comment.
Simplifies a lot of code. Nice.
| #define __Pyx_CyFunction_MethodDef(cyfunc) ((cyfunc)->func_methoddef) | ||
| #define __Pyx_CyFunction_Module(cyfunc) ((cyfunc)->func_module) |
There was a problem hiding this comment.
Might be worth a comment that these macros are expected to be lvalues (thus the missing Get in their name).
|
I'll wait for confirmation from the GraalPy people that this doesn't cause unexpected problems for them before merging it. I'm pretty sure it is good. But it would be a bit unhelpful to make a change for their benefit that actually makes things worse. |
| #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL | ||
| PyObject *func_weakreflist; | ||
| // No-args super() class cell | ||
| PyObject *func_classobj; |
There was a problem hiding this comment.
Moving this field up changes much of the struct layout. I know that we only share our extension types per Cython version, but this seems something I wouldn't expect in a point release.
There was a problem hiding this comment.
Reverted. I think it should be harmless but it also doesn't give us anything except one less pre-processor guard.
This reverts commit 6008b9b.
|
Looks good to me |
This avoids them having to write accessor functions to reach inside PyCFunctionObject.
Use macros to avoid repeating the
MethodDefandModuleaccess.