Skip to content

Commit 7ba122c

Browse files
committed
Skip test_gc() on limited C API 3.9
1 parent 412f771 commit 7ba122c

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎pythoncapi_compat.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ static inline int PyModule_AddType(PyObject *module, PyTypeObject *type)
533533

534534
// bpo-40241 added PyObject_GC_IsTracked() to Python 3.9.0a6.
535535
// bpo-4688 added _PyObject_GC_IS_TRACKED() to Python 2.7.0a2.
536-
// On Windows, PyObject_GC_IsTracked() was only added to limited C API 3.10.
536+
// On Windows, PyObject_GC_IsTracked() was only added to stable ABI 3.10.
537537
#if PY_VERSION_HEX < 0x030900A6 && !defined(PYPY_VERSION) && !defined(Py_LIMITED_API)
538538
static inline int PyObject_GC_IsTracked(PyObject* obj)
539539
{
@@ -543,7 +543,7 @@ static inline int PyObject_GC_IsTracked(PyObject* obj)
543543

544544
// bpo-40241 added PyObject_GC_IsFinalized() to Python 3.9.0a6.
545545
// bpo-18112 added _PyGCHead_FINALIZED() to Python 3.4.0 final.
546-
// On Windows, PyObject_GC_IsFinalized() was only added to limited C API 3.10.
546+
// On Windows, PyObject_GC_IsFinalized() was only added to stable ABI 3.10.
547547
#if PY_VERSION_HEX < 0x030900A6 && !defined(PYPY_VERSION) && !defined(Py_LIMITED_API)
548548
static inline int PyObject_GC_IsFinalized(PyObject *obj)
549549
{

‎tests/test_pythoncapi_compat_cext.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,11 @@ test_calls(PyObject *Py_UNUSED(module), PyObject* Py_UNUSED(ignored))
396396
}
397397

398398

399-
#if !(defined(Py_LIMITED_API) && PY_VERSION_HEX < 0x03090000) && !defined(PYPY_VERSION)
399+
// PyObject_GC_IsTracked() and PyObject_GC_IsFinalized() are part of the
400+
// limited C API 3.9. But on Windows, the functions are only exported in stable
401+
// ABI 3.10. Don't test the function in limited C API 3.9 on Unix to make the
402+
// test simpler.
403+
#if (!defined(Py_LIMITED_API) || PY_VERSION_HEX >= 0x030A0000) && !defined(PYPY_VERSION)
400404
static PyObject *
401405
test_gc(PyObject *Py_UNUSED(module), PyObject* Py_UNUSED(ignored))
402406
{
@@ -2651,7 +2655,7 @@ static struct PyMethodDef methods[] = {
26512655
#endif
26522656
{"test_interpreter", test_interpreter, METH_NOARGS, _Py_NULL},
26532657
{"test_calls", test_calls, METH_NOARGS, _Py_NULL},
2654-
#if !(defined(Py_LIMITED_API) && PY_VERSION_HEX < 0x03090000) && !defined(PYPY_VERSION)
2658+
#if (!defined(Py_LIMITED_API) || PY_VERSION_HEX >= 0x030A0000) && !defined(PYPY_VERSION)
26552659
{"test_gc", test_gc, METH_NOARGS, _Py_NULL},
26562660
#endif
26572661
{"test_module", test_module, METH_NOARGS, _Py_NULL},

0 commit comments

Comments
 (0)