Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cab493b

Browse files
committed
Fix support with PyPy 3.7
PyPy doesn't have PyThreadState.id member: omit PyThreadState_GetID() function on PyPy 3.7.
1 parent b3fc3ab commit cab493b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

pythoncapi_compat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ PyInterpreterState_Get(void)
224224

225225

226226
// bpo-39947 added PyInterpreterState_Get() to Python 3.9.0a6
227-
#if 0x030700A1 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x030900A6
227+
#if 0x030700A1 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x030900A6 && !defined(PYPY_VERSION)
228228
static inline uint64_t
229229
PyThreadState_GetID(PyThreadState *tstate)
230230
{

tests/test_pythoncapi_compat_cext.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ test_thread_state(PyObject *Py_UNUSED(module), PyObject* Py_UNUSED(ignored))
189189
Py_XDECREF(frame);
190190
#endif
191191

192-
#if 0x030700A1 <= PY_VERSION_HEX
192+
#if 0x030700A1 <= PY_VERSION_HEX && !defined(PYPY_VERSION)
193193
uint64_t id = PyThreadState_GetID(tstate);
194194
assert(id > 0);
195195
#endif

0 commit comments

Comments
 (0)