Skip to content
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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

0dminnimda
Copy link
Contributor

@0dminnimda 0dminnimda commented Jan 23, 2023

Extract out and use common functoin __Pyx_PyMethodDescr_Check
Depends on #5219 - this pr should fix some changes to the problematic area

Copy link
Contributor

@scoder scoder left a comment

Choose a reason for hiding this comment

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

Looks good overall.

Cython/Utility/CythonFunction.c Outdated Show resolved Hide resolved
@scoder scoder added this to the 3.0 milestone Jan 24, 2023
@scoder scoder added the cleanup label Jan 24, 2023
@scoder
Copy link
Contributor

scoder commented Jan 24, 2023

According to the build logs, there's a mismatch in braces.

@@ -2063,6 +2039,13 @@ static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
target->method = unbound_method;
}
}
#if CYTHON_COMPILING_IN_CPYTHON
Copy link
Contributor Author

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

Copy link
Contributor

@scoder scoder left a 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.

Cython/Utility/CythonFunction.c Outdated Show resolved Hide resolved
Cython/Utility/CythonFunction.c Outdated Show resolved Hide resolved
// 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;
Copy link
Contributor

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>
@scoder scoder removed this from the 3.0 milestone Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants