Skip to content

Commit 0c0348a

Browse files
authored
gh-120579: Guard _testcapi import in test_free_threading (#120580)
1 parent cf49ef7 commit 0c0348a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Lib/test/test_free_threading/test_dict.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
from threading import Thread
99
from unittest import TestCase
1010

11-
from _testcapi import dict_version
11+
try:
12+
import _testcapi
13+
except ImportError:
14+
_testcapi = None
1215

1316
from test.support import threading_helper
1417

@@ -139,7 +142,9 @@ def writer_func(l):
139142
for ref in thread_list:
140143
self.assertIsNone(ref())
141144

145+
@unittest.skipIf(_testcapi is None, 'need _testcapi module')
142146
def test_dict_version(self):
147+
dict_version = _testcapi.dict_version
143148
THREAD_COUNT = 10
144149
DICT_COUNT = 10000
145150
lists = []

0 commit comments

Comments
 (0)