Skip to content

Commit e0adfa3

Browse files
committed
Fix PyInterpreterState_Get()
1 parent 856dac3 commit e0adfa3

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎pythoncapi_compat.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,10 @@ _PyThreadState_GetFrameBorrow(PyThreadState *tstate)
330330

331331
// bpo-39947 added PyInterpreterState_Get() to Python 3.9.0a5
332332
// PyPy added PyInterpreterState_Get() to PyPy3.12 v8.0.0
333-
#if (PY_VERSION_HEX < 0x030900A5 \
333+
// On Windows, PyInterpreterState_Get() was added to limited C API 3.10.
334+
#if ((PY_VERSION_HEX < 0x030900A5 \
334335
|| (defined(PYPY_VERSION) && PY_VERSION_HEX < 0x030C0000)) \
335-
&& !defined(Py_LIMITED_API)
336+
&& !(defined(Py_LIMITED_API) && PY_VERSION_HEX < 0x030A0000))
336337
static inline PyInterpreterState* PyInterpreterState_Get(void)
337338
{
338339
PyThreadState *tstate;

‎tests/test_pythoncapi_compat_cext.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ test_thread_state(PyObject *Py_UNUSED(module), PyObject* Py_UNUSED(ignored))
332332
static PyObject *
333333
test_interpreter(PyObject *Py_UNUSED(module), PyObject* Py_UNUSED(ignored))
334334
{
335-
#if !(defined(Py_LIMITED_API) && PY_VERSION_HEX < 0x030900A5)
335+
#if !(defined(Py_LIMITED_API) && PY_VERSION_HEX < 0x030A0000)
336336
// test PyInterpreterState_Get()
337337
PyInterpreterState *interp = PyInterpreterState_Get();
338338
assert(interp != _Py_NULL);

0 commit comments

Comments
 (0)