summaryrefslogtreecommitdiffstats
path: root/Programs/_testembed.c
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 /Programs/_testembed.c
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 'Programs/_testembed.c')
-rw-r--r--Programs/_testembed.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Programs/_testembed.c b/Programs/_testembed.c
index 1f9aa4b..30998bf 100644
--- a/Programs/_testembed.c
+++ b/Programs/_testembed.c
@@ -576,7 +576,11 @@ static int test_init_from_config(void)
_PyPreConfig_InitCompatConfig(&preconfig);
putenv("PYTHONMALLOC=malloc_debug");
+#ifndef Py_GIL_DISABLED
preconfig.allocator = PYMEM_ALLOCATOR_MALLOC;
+#else
+ preconfig.allocator = PYMEM_ALLOCATOR_MIMALLOC;
+#endif
putenv("PYTHONUTF8=0");
Py_UTF8Mode = 0;
@@ -765,7 +769,11 @@ static int test_init_dont_parse_argv(void)
static void set_most_env_vars(void)
{
putenv("PYTHONHASHSEED=42");
+#ifndef Py_GIL_DISABLED
putenv("PYTHONMALLOC=malloc");
+#else
+ putenv("PYTHONMALLOC=mimalloc");
+#endif
putenv("PYTHONTRACEMALLOC=2");
putenv("PYTHONPROFILEIMPORTTIME=1");
putenv("PYTHONNODEBUGRANGES=1");
@@ -851,7 +859,11 @@ static int test_init_env_dev_mode_alloc(void)
/* Test initialization from environment variables */
Py_IgnoreEnvironmentFlag = 0;
set_all_env_vars_dev_mode();
+#ifndef Py_GIL_DISABLED
putenv("PYTHONMALLOC=malloc");
+#else
+ putenv("PYTHONMALLOC=mimalloc");
+#endif
_testembed_Py_InitializeFromConfig();
dump_config();
Py_Finalize();