Skip to content

Commit 60ec08b

Browse files
authored
Change C includes of "longintrepr.h" to account for upstream changes (GH-4428)
See python/cpython#28968 which is part of implementing https://bugs.python.org/issue35134 moved the header "longintrepr.h" into a sub-folder. The notes on this change suggested to include "Python.h" instead.
1 parent 09cbf49 commit 60ec08b

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

Cython/Includes/cpython/longintrepr.pxd

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# Internals of the "long" type (Python 2) or "int" type (Python 3).
2-
# This is not part of Python's published API.
32

4-
cdef extern from "longintrepr.h":
3+
cdef extern from "Python.h":
4+
"""
5+
#if PY_MAJOR_VERSION < 3
6+
#include "longintrepr.h"
7+
#endif
8+
"""
59
ctypedef unsigned int digit
610
ctypedef int sdigit # Python >= 2.7 only
711

Cython/Utility/ModuleSetupCode.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,9 @@
263263
#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
264264

265265
#if CYTHON_USE_PYLONG_INTERNALS
266-
#include "longintrepr.h"
266+
#if PY_MAJOR_VERSION < 3
267+
#include "longintrepr.h"
268+
#endif
267269
/* These short defines can easily conflict with other code */
268270
#undef SHIFT
269271
#undef BASE

tests/compile/pylong.pyx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ cdef extern from "Python.h":
88
Py_ssize_t ob_refcnt
99
PyTypeObject *ob_type
1010

11-
cdef extern from "longintrepr.h":
11+
cdef extern from "Python.h":
12+
"""
13+
#if PY_MAJOR_VERSION < 3
14+
#include "longintrepr.h"
15+
#endif
16+
"""
1217
cdef struct _longobject:
1318
int ob_refcnt
1419
PyTypeObject *ob_type

0 commit comments

Comments
 (0)