gh-120579: Guard `_testcapi` import in `test_free_threading` (#120580)

This commit is contained in:
Nikita Sobolev 2024-06-16 11:26:13 +03:00 committed by GitHub
parent cf49ef78f8
commit 0c0348adbf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -8,7 +8,10 @@ from functools import partial
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 @@ class TestDict(TestCase):
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 = []