Hello everyone,
When compiling a class with a classmethod using the limited API I get the following error:
clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -DCYTHON_LIMITED_API=1 -DPy_LIMITED_API=0x030B0000 -I/private/var/folders/l4/gpyzwv455hzbmbv78x05555h0000gn/T/build-env-ok8opy1u/include -I/opt/homebrew/opt/pyt...@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c limited_classmethod.cpp -o build/temp.macosx-14-arm64-cpython-311/limited_classmethod.o
limited_classmethod.cpp:6876:5: error: no matching function for call to 'Py_TYPE'
__Pyx_PyHeapTypeObject_GC_Del(m);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
limited_classmethod.cpp:971:26: note: expanded from macro '__Pyx_PyHeapTypeObject_GC_Del'
PyTypeObject *type = Py_TYPE(obj);\
^~~~~~~
/opt/homebrew/opt/pyt...@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/object.h:132:29: note: candidate function not viable: no known conversion from '__pyx_CyFunctionObject *' to 'PyObject *' (aka '_object *') for 1st argument
static inline PyTypeObject* Py_TYPE(PyObject *ob) {
^
limited_classmethod.cpp:7396:9: error: use of undeclared identifier 'PyMethodDescrObject'; did you mean 'PyMethodDescr_Type'?
PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
^~~~~~~~~~~~~~~~~~~
PyMethodDescr_Type
/opt/homebrew/opt/pyt...@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/descrobject.h:22:26: note: 'PyMethodDescr_Type' declared here
PyAPI_DATA(PyTypeObject) PyMethodDescr_Type;
^
limited_classmethod.cpp:7396:39: error: use of undeclared identifier 'PyMethodDescrObject'; did you mean 'PyMethodDescr_Type'?
PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
^~~~~~~~~~~~~~~~~~~
PyMethodDescr_Type
/opt/homebrew/opt/pyt...@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/descrobject.h:22:26: note: 'PyMethodDescr_Type' declared here
PyAPI_DATA(PyTypeObject) PyMethodDescr_Type;
^
limited_classmethod.cpp:7396:60: error: expected expression
PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
^
limited_classmethod.cpp:7396:30: error: use of undeclared identifier 'descr'
PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
^
limited_classmethod.cpp:7400:32: error: use of undeclared identifier 'descr'
PyTypeObject *d_type = descr->d_common.d_type;
^
limited_classmethod.cpp:7402:47: error: use of undeclared identifier 'descr'
return PyDescr_NewClassMethod(d_type, descr->d_method);
^
limited_classmethod.cpp:7405:14: error: use of undeclared identifier 'PyMethod_Check'
else if (PyMethod_Check(method)) {
^
limited_classmethod.cpp:7406:34: error: use of undeclared identifier 'PyMethod_GET_FUNCTION'
return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
^
limited_classmethod.cpp:7409:16: error: use of undeclared identifier 'PyClassMethod_New'
return PyClassMethod_New(method);
^
10 errors generated.
# limited_classmethod.pyx cdef class A: @classmethod def method(cls): pass
It should compile.
No response
No response
No response
classmethod implementation: https://github.com/cython/cython/blob/0f2a0d38b60e10e401aa1435801b2b8975083c7b/Cython/Utility/CythonFunction.c#L1754-L1804
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Closed #5797 as completed via d9dde8b.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Closed #5797 as completed via #5800.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()