Skip to content

Commit b9f0943

Browse files
gh-127945: skip more tests in ctypes when using parallel threads (#132682)
1 parent 2f8b08d commit b9f0943

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Lib/test/test_ctypes/test_pickling.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from ctypes import (CDLL, Structure, CFUNCTYPE, pointer,
44
c_void_p, c_char_p, c_wchar_p,
55
c_char, c_wchar, c_int, c_double)
6-
from test.support import import_helper
6+
from test.support import import_helper, thread_unsafe
77
_ctypes_test = import_helper.import_module("_ctypes_test")
88

99

@@ -21,7 +21,6 @@ def __init__(self, *args, **kw):
2121
class Y(X):
2222
_fields_ = [("str", c_char_p)]
2323

24-
2524
class PickleTest:
2625
def dumps(self, item):
2726
return pickle.dumps(item, self.proto)
@@ -39,6 +38,7 @@ def test_simple(self):
3938
self.assertEqual(memoryview(src).tobytes(),
4039
memoryview(dst).tobytes())
4140

41+
@thread_unsafe('not thread safe')
4242
def test_struct(self):
4343
X.init_called = 0
4444

Lib/test/test_ctypes/test_refcounts.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
import unittest
55
from test import support
6-
from test.support import import_helper
6+
from test.support import import_helper, thread_unsafe
77
from test.support import script_helper
88
_ctypes_test = import_helper.import_module("_ctypes_test")
99

@@ -13,7 +13,7 @@
1313

1414
dll = ctypes.CDLL(_ctypes_test.__file__)
1515

16-
16+
@thread_unsafe('not thread safe')
1717
class RefcountTestCase(unittest.TestCase):
1818
@support.refcount_test
1919
def test_1(self):
@@ -82,7 +82,7 @@ class X(ctypes.Structure):
8282
gc.collect()
8383
self.assertEqual(sys.getrefcount(func), orig_refcount)
8484

85-
85+
@thread_unsafe('not thread safe')
8686
class AnotherLeak(unittest.TestCase):
8787
def test_callback(self):
8888
proto = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.c_int)

0 commit comments

Comments
 (0)