https://github.com/python/cpython/commit/b9f0943c1e31acd0895a4b57b4af57a5a1e0a2b1
commit: b9f0943c1e31acd0895a4b57b4af57a5a1e0a2b1
branch: main
author: Kumar Aditya <kumaradi...@python.org>
committer: kumaraditya303 <kumaradi...@python.org>
date: 2025-04-18T13:12:45Z
summary:

gh-127945: skip more tests in ctypes when using parallel threads  (#132682)

files:
M Lib/test/test_ctypes/test_pickling.py
M Lib/test/test_ctypes/test_refcounts.py

diff --git a/Lib/test/test_ctypes/test_pickling.py 
b/Lib/test/test_ctypes/test_pickling.py
index 9d433fc69de391..8f8c09f1fb6a43 100644
--- a/Lib/test/test_ctypes/test_pickling.py
+++ b/Lib/test/test_ctypes/test_pickling.py
@@ -3,7 +3,7 @@
 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 @@ def __init__(self, *args, **kw):
 class Y(X):
     _fields_ = [("str", c_char_p)]
 
-
 class PickleTest:
     def dumps(self, item):
         return pickle.dumps(item, self.proto)
@@ -39,6 +38,7 @@ def test_simple(self):
             self.assertEqual(memoryview(src).tobytes(),
                                  memoryview(dst).tobytes())
 
+    @thread_unsafe('not thread safe')
     def test_struct(self):
         X.init_called = 0
 
diff --git a/Lib/test/test_ctypes/test_refcounts.py 
b/Lib/test/test_ctypes/test_refcounts.py
index 5f2f5c4a84d52e..1815649ceb5fff 100644
--- a/Lib/test/test_ctypes/test_refcounts.py
+++ b/Lib/test/test_ctypes/test_refcounts.py
@@ -3,7 +3,7 @@
 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 @@
 
 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 X(ctypes.Structure):
         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)

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to