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
Extract __Pyx_PyMethodDescr_Check
#5225
base: master
Are you sure you want to change the base?
Extract __Pyx_PyMethodDescr_Check
#5225
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall.
According to the build logs, there's a mismatch in braces. |
Cython/Utility/ObjectHandling.c
Outdated
@@ -2063,6 +2039,13 @@ static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { | |||
target->method = unbound_method; | |||
} | |||
} | |||
#if CYTHON_COMPILING_IN_CPYTHON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little bit confused about whether this should remain in the code or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the build status, your refactoring is not correct. It behaves differently now.
// PyMethodDescr_Type is not exposed in the CPython C-API in Py2. | ||
static PyTypeObject *methoddescr_type = NULL; | ||
if (unlikely(methoddescr_type == NULL)) { | ||
PyObject *meth = PyObject_GetAttrString((PyObject*)&PyList_Type, "append"); | ||
if (unlikely(!meth)) return NULL; | ||
if (unlikely(!meth)) return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be an error case, not just false/0.
Co-authored-by: scoder <stefan_ml@behnel.de>
Extract out and use common functoin
__Pyx_PyMethodDescr_Check
Depends on #5219 - this pr should fix some changes to the problematic area