]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-127945: skip more tests in ctypes when using parallel threads (#132682)
authorKumar Aditya <kumaraditya@python.org>
Fri, 18 Apr 2025 13:12:45 +0000 (18:42 +0530)
committerGitHub <noreply@github.com>
Fri, 18 Apr 2025 13:12:45 +0000 (13:12 +0000)
Lib/test/test_ctypes/test_pickling.py
Lib/test/test_ctypes/test_refcounts.py

index 9d433fc69de3912647cc2caadeeae69823248d8f..8f8c09f1fb6a4374f93cfd8ec8d7bbdd990d3ca2 100644 (file)
@@ -3,7 +3,7 @@ import unittest
 from ctypes import (CDLL, Structure, CFUNCTYPE, pointer,
                     c_void_p, c_char_p, c_wchar_p,
                     c_char, c_wchar, c_int, c_double)
-from test.support import import_helper
+from test.support import import_helper, thread_unsafe
 _ctypes_test = import_helper.import_module("_ctypes_test")
 
 
@@ -21,7 +21,6 @@ class X(Structure):
 class Y(X):
     _fields_ = [("str", c_char_p)]
 
-
 class PickleTest:
     def dumps(self, item):
         return pickle.dumps(item, self.proto)
@@ -39,6 +38,7 @@ class PickleTest:
             self.assertEqual(memoryview(src).tobytes(),
                                  memoryview(dst).tobytes())
 
+    @thread_unsafe('not thread safe')
     def test_struct(self):
         X.init_called = 0
 
index 5f2f5c4a84d52ef38afa13112c58c9d984397996..1815649ceb5fff94a39cb9bc884702ff3f284649 100644 (file)
@@ -3,7 +3,7 @@ import gc
 import sys
 import unittest
 from test import support
-from test.support import import_helper
+from test.support import import_helper, thread_unsafe
 from test.support import script_helper
 _ctypes_test = import_helper.import_module("_ctypes_test")
 
@@ -13,7 +13,7 @@ OtherCallback = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.c_ulonglong)
 
 dll = ctypes.CDLL(_ctypes_test.__file__)
 
-
+@thread_unsafe('not thread safe')
 class RefcountTestCase(unittest.TestCase):
     @support.refcount_test
     def test_1(self):
@@ -82,7 +82,7 @@ class RefcountTestCase(unittest.TestCase):
         gc.collect()
         self.assertEqual(sys.getrefcount(func), orig_refcount)
 
-
+@thread_unsafe('not thread safe')
 class AnotherLeak(unittest.TestCase):
     def test_callback(self):
         proto = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.c_int)