[3.13] gh-120579: Guard _testcapi import in test_free_threading (GH-120580) (#120583)

gh-120579: Guard `_testcapi` import in `test_free_threading` (GH-120580)
(cherry picked from commit 0c0348adbf)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
Miss Islington (bot) 2024-06-16 10:50:33 +02:00 committed by GitHub
parent eee2c45633
commit f2a4540c4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,7 +8,10 @@
from threading import Thread
from unittest import TestCase
from _testcapi import dict_version
try:
import _testcapi
except ImportError:
_testcapi = None
from test.support import threading_helper
@ -139,7 +142,9 @@ def writer_func(l):
for ref in thread_list:
self.assertIsNone(ref())
@unittest.skipIf(_testcapi is None, 'need _testcapi module')
def test_dict_version(self):
dict_version = _testcapi.dict_version
THREAD_COUNT = 10
DICT_COUNT = 10000
lists = []