Skip to content

Commit c617a0e

Browse files
committed
Wrap m.intentional_deadlock in a Python function, for Windows ForkingPickler compatibility.
``` > ForkingPickler(file, protocol).dump(obj) E TypeError: cannot pickle 'PyCapsule' object ```
1 parent ea8b132 commit c617a0e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/test_gil_scoped.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@ def test_all_basic_tests_completeness():
138138
assert len(ALL_BASIC_TESTS) == num_found
139139

140140

141-
ALL_BASIC_TESTS_PLUS_INTENTIONAL_DEADLOCK = ALL_BASIC_TESTS + (m.intentional_deadlock,)
141+
def _intentional_deadlock():
142+
m.intentional_deadlock()
143+
144+
145+
ALL_BASIC_TESTS_PLUS_INTENTIONAL_DEADLOCK = ALL_BASIC_TESTS + (_intentional_deadlock,)
142146

143147

144148
def _run_in_process(target, *args, **kwargs):
@@ -147,7 +151,7 @@ def _run_in_process(target, *args, **kwargs):
147151
else:
148152
test_fn = args[0]
149153
# Do not need to wait much, 10s should be more than enough.
150-
timeout = 0.1 if test_fn is m.intentional_deadlock else 10
154+
timeout = 0.1 if test_fn is _intentional_deadlock else 10
151155
process = multiprocessing.Process(target=target, args=args, kwargs=kwargs)
152156
process.daemon = True
153157
try:
@@ -164,7 +168,7 @@ def _run_in_process(target, *args, **kwargs):
164168
pytest.skip(
165169
"ThreadSanitizer: starting new threads after multi-threaded fork is not supported."
166170
)
167-
elif test_fn is m.intentional_deadlock:
171+
elif test_fn is _intentional_deadlock:
168172
assert process.exitcode is None
169173
return 0
170174
elif process.exitcode is None:

0 commit comments

Comments
 (0)