Skip to content

Commit eb81c1a

Browse files
authored
Disable Limited API tests with Py_TRACE_REFS (GH-95796)
1 parent 7c8626a commit eb81c1a

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

Lib/test/test_call.py

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import itertools
1010
import gc
1111
import contextlib
12+
import sys
1213

1314

1415
class BadStr(str):
@@ -759,6 +760,9 @@ def __call__(self, *args):
759760
self.assertEqual(expected, meth(*args1, **kwargs))
760761
self.assertEqual(expected, wrapped(*args, **kwargs))
761762

763+
@unittest.skipIf(
764+
hasattr(sys, 'getobjects'),
765+
"Limited API is not compatible with Py_TRACE_REFS")
762766
def test_vectorcall_limited(self):
763767
from _testcapi import pyobject_vectorcall
764768
obj = _testcapi.LimitedVectorCallClass()

Modules/_testcapi/vectorcall_limited.c

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
#include "pyconfig.h" // Py_TRACE_REFS
2+
3+
#ifdef Py_TRACE_REFS
4+
5+
// Py_TRACE_REFS is incompatible with Limited API
6+
#include "parts.h"
7+
int
8+
_PyTestCapi_Init_VectorcallLimited(PyObject *m) {
9+
return 0;
10+
}
11+
12+
#else
13+
114
#define Py_LIMITED_API 0x030c0000 // 3.12
215
#include "parts.h"
316
#include "structmember.h" // PyMemberDef
@@ -75,3 +88,5 @@ _PyTestCapi_Init_VectorcallLimited(PyObject *m) {
7588

7689
return 0;
7790
}
91+
92+
#endif // Py_TRACE_REFS

0 commit comments

Comments
 (0)