summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_cmd_line.py
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2023-12-12 00:04:48 (GMT)
committerGitHub <noreply@github.com>2023-12-12 00:04:48 (GMT)
commitfdee7b7b3e15931d58f07e5449de2e55b4d48b05 (patch)
treee04dca3c8005a42f1d5973938e6e41c64a6a6a26 /Lib/test/test_cmd_line.py
parentfed294c6453527addd1644633849e2d8492058c5 (diff)
downloadcpython-fdee7b7b3e15931d58f07e5449de2e55b4d48b05.zip
cpython-fdee7b7b3e15931d58f07e5449de2e55b4d48b05.tar.gz
cpython-fdee7b7b3e15931d58f07e5449de2e55b4d48b05.tar.bz2
gh-112532: Require mimalloc in `--disable-gil` builds (gh-112883)
Diffstat (limited to 'Lib/test/test_cmd_line.py')
-rw-r--r--Lib/test/test_cmd_line.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index 7a27952..1fe3b2f 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -738,6 +738,8 @@ class CmdLineTest(unittest.TestCase):
out = self.run_xdev("-c", code, check_exitcode=False)
if support.with_pymalloc():
alloc_name = "pymalloc_debug"
+ elif support.Py_GIL_DISABLED:
+ alloc_name = "mimalloc_debug"
else:
alloc_name = "malloc_debug"
self.assertEqual(out, alloc_name)
@@ -814,9 +816,13 @@ class CmdLineTest(unittest.TestCase):
@support.cpython_only
def test_pythonmalloc(self):
# Test the PYTHONMALLOC environment variable
+ malloc = not support.Py_GIL_DISABLED
pymalloc = support.with_pymalloc()
mimalloc = support.with_mimalloc()
- if pymalloc:
+ if support.Py_GIL_DISABLED:
+ default_name = 'mimalloc_debug' if support.Py_DEBUG else 'mimalloc'
+ default_name_debug = 'mimalloc_debug'
+ elif pymalloc:
default_name = 'pymalloc_debug' if support.Py_DEBUG else 'pymalloc'
default_name_debug = 'pymalloc_debug'
else:
@@ -826,9 +832,12 @@ class CmdLineTest(unittest.TestCase):
tests = [
(None, default_name),
('debug', default_name_debug),
- ('malloc', 'malloc'),
- ('malloc_debug', 'malloc_debug'),
]
+ if malloc:
+ tests.extend([
+ ('malloc', 'malloc'),
+ ('malloc_debug', 'malloc_debug'),
+ ])
if pymalloc:
tests.extend((
('pymalloc', 'pymalloc'),