Commit c23195dd authored by Matti Picus's avatar Matti Picus Committed by GitHub

Allow setting descriptor docstring on PyPy>v7.3.9 (GH-4694)

parent b3936069
...@@ -3697,7 +3697,7 @@ class DefNodeWrapper(FuncDefNode): ...@@ -3697,7 +3697,7 @@ class DefNodeWrapper(FuncDefNode):
docstr.as_c_string_literal())) docstr.as_c_string_literal()))
if entry.is_special: if entry.is_special:
code.putln('#if CYTHON_COMPILING_IN_CPYTHON') code.putln('#if CYTHON_UPDATE_DESCRIPTOR_DOC')
code.putln( code.putln(
"struct wrapperbase %s;" % entry.wrapperbase_cname) "struct wrapperbase %s;" % entry.wrapperbase_cname)
code.putln('#endif') code.putln('#endif')
...@@ -5503,7 +5503,7 @@ class CClassDefNode(ClassDefNode): ...@@ -5503,7 +5503,7 @@ class CClassDefNode(ClassDefNode):
preprocessor_guard = slot.preprocessor_guard_code() if slot else None preprocessor_guard = slot.preprocessor_guard_code() if slot else None
if preprocessor_guard: if preprocessor_guard:
code.putln(preprocessor_guard) code.putln(preprocessor_guard)
code.putln('#if CYTHON_COMPILING_IN_CPYTHON') code.putln('#if CYTHON_UPDATE_DESCRIPTOR_DOC')
code.putln("{") code.putln("{")
code.putln( code.putln(
'PyObject *wrapper = PyObject_GetAttrString((PyObject *)%s, "%s"); %s' % ( 'PyObject *wrapper = PyObject_GetAttrString((PyObject *)%s, "%s"); %s' % (
......
...@@ -109,6 +109,9 @@ ...@@ -109,6 +109,9 @@
#define CYTHON_USE_DICT_VERSIONS 0 #define CYTHON_USE_DICT_VERSIONS 0
#undef CYTHON_USE_EXC_INFO_STACK #undef CYTHON_USE_EXC_INFO_STACK
#define CYTHON_USE_EXC_INFO_STACK 0 #define CYTHON_USE_EXC_INFO_STACK 0
#ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
#define CYTHON_UPDATE_DESCRIPTOR_DOC 0
#endif
#elif defined(PYPY_VERSION) #elif defined(PYPY_VERSION)
#define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_CPYTHON 0
...@@ -162,6 +165,9 @@ ...@@ -162,6 +165,9 @@
#define CYTHON_USE_DICT_VERSIONS 0 #define CYTHON_USE_DICT_VERSIONS 0
#undef CYTHON_USE_EXC_INFO_STACK #undef CYTHON_USE_EXC_INFO_STACK
#define CYTHON_USE_EXC_INFO_STACK 0 #define CYTHON_USE_EXC_INFO_STACK 0
#ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
#define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_HEX >= 0x07030900)
#endif
#elif defined(CYTHON_LIMITED_API) #elif defined(CYTHON_LIMITED_API)
// EXPERIMENTAL !! // EXPERIMENTAL !!
#define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYPY 0
...@@ -219,6 +225,9 @@ ...@@ -219,6 +225,9 @@
#define CYTHON_USE_DICT_VERSIONS 0 #define CYTHON_USE_DICT_VERSIONS 0
#undef CYTHON_USE_EXC_INFO_STACK #undef CYTHON_USE_EXC_INFO_STACK
#define CYTHON_USE_EXC_INFO_STACK 0 #define CYTHON_USE_EXC_INFO_STACK 0
#ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
#define CYTHON_UPDATE_DESCRIPTOR_DOC 0
#endif
#else #else
#define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1 #define CYTHON_COMPILING_IN_CPYTHON 1
...@@ -312,6 +321,9 @@ ...@@ -312,6 +321,9 @@
#elif !defined(CYTHON_USE_EXC_INFO_STACK) #elif !defined(CYTHON_USE_EXC_INFO_STACK)
#define CYTHON_USE_EXC_INFO_STACK 1 #define CYTHON_USE_EXC_INFO_STACK 1
#endif #endif
#ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
#define CYTHON_UPDATE_DESCRIPTOR_DOC 1
#endif
#endif #endif
#if !defined(CYTHON_FAST_PYCCALL) #if !defined(CYTHON_FAST_PYCCALL)
......
...@@ -509,7 +509,9 @@ static CYTHON_INLINE PyObject* __Pyx__PyNumber_Float(PyObject* obj) { ...@@ -509,7 +509,9 @@ static CYTHON_INLINE PyObject* __Pyx__PyNumber_Float(PyObject* obj) {
if (unlikely(val == -1 && PyErr_Occurred())) { if (unlikely(val == -1 && PyErr_Occurred())) {
return NULL; return NULL;
} }
#if CYTHON_USE_PYLONG_INTERNALS
no_error: no_error:
#endif
return PyFloat_FromDouble(val); return PyFloat_FromDouble(val);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment