summaryrefslogtreecommitdiff
path: root/Lib/test/test_sys.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_sys.py')
-rw-r--r--Lib/test/test_sys.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 4bd54af362..d1c7daad7b 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -767,8 +767,13 @@ class SysModuleTest(unittest.TestCase):
except ImportError:
with_pymalloc = support.with_pymalloc()
else:
- alloc_name = _testcapi.pymem_getallocatorsname()
- with_pymalloc = (alloc_name in ('pymalloc', 'pymalloc_debug'))
+ try:
+ alloc_name = _testcapi.pymem_getallocatorsname()
+ except RuntimeError as exc:
+ # "cannot get allocators name" (ex: tracemalloc is used)
+ with_pymalloc = True
+ else:
+ with_pymalloc = (alloc_name in ('pymalloc', 'pymalloc_debug'))
# Some sanity checks
a = sys.getallocatedblocks()