[Python-checkins] Disable Limited API tests with Py_TRACE_REFS (GH-95796)

encukou webhook-mailer at python.org
Tue Aug 9 03:03:26 EDT 2022


https://github.com/python/cpython/commit/eb81c1aea16914347919745e843c982ed831a9fb
commit: eb81c1aea16914347919745e843c982ed831a9fb
branch: main
author: Petr Viktorin <encukou at gmail.com>
committer: encukou <encukou at gmail.com>
date: 2022-08-09T09:03:11+02:00
summary:

Disable Limited API tests with Py_TRACE_REFS (GH-95796)

files:
M Lib/test/test_call.py
M Modules/_testcapi/vectorcall_limited.c

diff --git a/Lib/test/test_call.py b/Lib/test/test_call.py
index d3a254f15b62..131b45e6caaa 100644
--- a/Lib/test/test_call.py
+++ b/Lib/test/test_call.py
@@ -9,6 +9,7 @@
 import itertools
 import gc
 import contextlib
+import sys
 
 
 class BadStr(str):
@@ -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()
diff --git a/Modules/_testcapi/vectorcall_limited.c b/Modules/_testcapi/vectorcall_limited.c
index 63ea3b3101b2..c5184318e292 100644
--- a/Modules/_testcapi/vectorcall_limited.c
+++ b/Modules/_testcapi/vectorcall_limited.c
@@ -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
@@ -75,3 +88,5 @@ _PyTestCapi_Init_VectorcallLimited(PyObject *m) {
 
     return 0;
 }
+
+#endif // Py_TRACE_REFS



More information about the Python-checkins mailing list