summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2022-04-01 19:15:21 +0300
committerGitHub <noreply@github.com>2022-04-01 18:15:21 +0200
commitebe515578cb4167c101baeb0ef7f4e3f6b2c6432 (patch)
tree65de407a3082b21ca3a430b4fc7df805ef0d9432
parentd395a56f8e68ee563f866d0dec5a31a37f77df9e (diff)
downloadcython-ebe515578cb4167c101baeb0ef7f4e3f6b2c6432.tar.gz
Allow setting descriptor docstring on PyPy>v7.3.9 (GH-4701)
-rw-r--r--Cython/Compiler/Nodes.py4
-rw-r--r--Cython/Utility/ModuleSetupCode.c9
2 files changed, 11 insertions, 2 deletions
diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py
index 6060611e7..93129cf69 100644
--- a/Cython/Compiler/Nodes.py
+++ b/Cython/Compiler/Nodes.py
@@ -3491,7 +3491,7 @@ class DefNodeWrapper(FuncDefNode):
docstr.as_c_string_literal()))
if entry.is_special:
- code.putln('#if CYTHON_COMPILING_IN_CPYTHON')
+ code.putln('#if CYTHON_UPDATE_DESCRIPTOR_DOC')
code.putln(
"struct wrapperbase %s;" % entry.wrapperbase_cname)
code.putln('#endif')
@@ -4986,7 +4986,7 @@ class CClassDefNode(ClassDefNode):
preprocessor_guard = slot.preprocessor_guard_code() if slot else None
if preprocessor_guard:
code.putln(preprocessor_guard)
- code.putln('#if CYTHON_COMPILING_IN_CPYTHON')
+ code.putln('#if CYTHON_UPDATE_DESCRIPTOR_DOC')
code.putln("{")
code.putln(
'PyObject *wrapper = PyObject_GetAttrString((PyObject *)&%s, "%s"); %s' % (
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
index e3740a6ed..b137e3071 100644
--- a/Cython/Utility/ModuleSetupCode.c
+++ b/Cython/Utility/ModuleSetupCode.c
@@ -83,6 +83,9 @@
#define CYTHON_USE_DICT_VERSIONS 0
#undef CYTHON_USE_EXC_INFO_STACK
#define CYTHON_USE_EXC_INFO_STACK 0
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_HEX >= 0x07030900)
+ #endif
#elif defined(PYSTON_VERSION)
#define CYTHON_COMPILING_IN_PYPY 0
@@ -126,6 +129,9 @@
#define CYTHON_USE_DICT_VERSIONS 0
#undef CYTHON_USE_EXC_INFO_STACK
#define CYTHON_USE_EXC_INFO_STACK 0
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
+ #endif
#else
#define CYTHON_COMPILING_IN_PYPY 0
@@ -203,6 +209,9 @@
#elif !defined(CYTHON_USE_EXC_INFO_STACK)
#define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
#endif
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
+ #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)