Skip to content

Commit

Permalink
Disable Limited API tests with Py_TRACE_REFS (pythonGH-95796)
Browse files Browse the repository at this point in the history
  • Loading branch information
encukou authored and iritkatriel committed Aug 11, 2022
1 parent 96fe457 commit 727595b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Lib/test/test_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import itertools
import gc
import contextlib
import sys


class BadStr(str):
Expand Down Expand Up @@ -759,6 +760,9 @@ def __call__(self, *args):
self.assertEqual(expected, meth(*args1, **kwargs))
self.assertEqual(expected, wrapped(*args, **kwargs))

@unittest.skipIf(
hasattr(sys, 'getobjects'),
"Limited API is not compatible with Py_TRACE_REFS")
def test_vectorcall_limited(self):
from _testcapi import pyobject_vectorcall
obj = _testcapi.LimitedVectorCallClass()
Expand Down
15 changes: 15 additions & 0 deletions Modules/_testcapi/vectorcall_limited.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
#include "pyconfig.h" // Py_TRACE_REFS

#ifdef Py_TRACE_REFS

// Py_TRACE_REFS is incompatible with Limited API
#include "parts.h"
int
_PyTestCapi_Init_VectorcallLimited(PyObject *m) {
return 0;
}

#else

#define Py_LIMITED_API 0x030c0000 // 3.12
#include "parts.h"
#include "structmember.h" // PyMemberDef
Expand Down Expand Up @@ -75,3 +88,5 @@ _PyTestCapi_Init_VectorcallLimited(PyObject *m) {

return 0;
}

#endif // Py_TRACE_REFS

0 comments on commit 727595b

Please sign in to comment.