mirror of
https://github.com/python/cpython.git
synced 2025-11-15 00:00:00 +00:00
gh-120579: Guard _testcapi import in test_free_threading (#120580)
This commit is contained in:
parent
cf49ef78f8
commit
0c0348adbf
1 changed files with 6 additions and 1 deletions
|
|
@ -8,7 +8,10 @@ from functools import partial
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
from _testcapi import dict_version
|
try:
|
||||||
|
import _testcapi
|
||||||
|
except ImportError:
|
||||||
|
_testcapi = None
|
||||||
|
|
||||||
from test.support import threading_helper
|
from test.support import threading_helper
|
||||||
|
|
||||||
|
|
@ -139,7 +142,9 @@ class TestDict(TestCase):
|
||||||
for ref in thread_list:
|
for ref in thread_list:
|
||||||
self.assertIsNone(ref())
|
self.assertIsNone(ref())
|
||||||
|
|
||||||
|
@unittest.skipIf(_testcapi is None, 'need _testcapi module')
|
||||||
def test_dict_version(self):
|
def test_dict_version(self):
|
||||||
|
dict_version = _testcapi.dict_version
|
||||||
THREAD_COUNT = 10
|
THREAD_COUNT = 10
|
||||||
DICT_COUNT = 10000
|
DICT_COUNT = 10000
|
||||||
lists = []
|
lists = []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue