Skip to content

Commit 1169a95

Browse files
Address review: use sysconfig.get_config_var in with_*malloc() helpers
1 parent b89a3dd commit 1169a95

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

Lib/test/support/__init__.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,19 +1883,12 @@ def restore(self):
18831883

18841884

18851885
def with_pymalloc():
1886-
try:
1887-
import _testcapi
1888-
except ImportError:
1889-
raise unittest.SkipTest("requires _testcapi")
1890-
return _testcapi.WITH_PYMALLOC and not Py_GIL_DISABLED
1886+
WITH_PYMALLOC = bool(sysconfig.get_config_var("WITH_PYMALLOC"))
1887+
return WITH_PYMALLOC and not Py_GIL_DISABLED
18911888

18921889

18931890
def with_mimalloc():
1894-
try:
1895-
import _testcapi
1896-
except ImportError:
1897-
raise unittest.SkipTest("requires _testcapi")
1898-
return _testcapi.WITH_MIMALLOC
1891+
return bool(sysconfig.get_config_var("WITH_MIMALLOC"))
18991892

19001893

19011894
class _ALWAYS_EQ:

0 commit comments

Comments
 (0)