diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-06-16 08:50:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-16 08:50:33 (GMT) |
commit | f2a4540c4fc3e9de4ca7b8a33463f71d795d86b2 (patch) | |
tree | b4c5b0b72410c2d3f06ab211607fa562de6f7931 | |
parent | eee2c456339363918de194b55385b8ce66175139 (diff) | |
download | cpython-f2a4540c4fc3e9de4ca7b8a33463f71d795d86b2.zip cpython-f2a4540c4fc3e9de4ca7b8a33463f71d795d86b2.tar.gz cpython-f2a4540c4fc3e9de4ca7b8a33463f71d795d86b2.tar.bz2 |
[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 0c0348adbfca991f78b3aaa6790e5c26606a1c0f)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
-rw-r--r-- | Lib/test/test_free_threading/test_dict.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_free_threading/test_dict.py b/Lib/test/test_free_threading/test_dict.py index f877582..3126458 100644 --- a/Lib/test/test_free_threading/test_dict.py +++ b/Lib/test/test_free_threading/test_dict.py @@ -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 = [] |