bpo-36142: PYTHONMALLOC overrides PYTHONDEV (GH-12191) · python/cpython@25d13f3 (original) (raw)
`@@ -442,8 +442,8 @@ static int test_init_from_config(void)
`
442
442
`config.use_hash_seed = 1;
`
443
443
`config.hash_seed = 123;
`
444
444
``
445
``
`-
putenv("PYTHONMALLOC=malloc");
`
446
``
`-
config.preconfig.allocator = "malloc_debug";
`
``
445
`+
putenv("PYTHONMALLOC=malloc_debug");
`
``
446
`+
config.preconfig.allocator = "malloc";
`
447
447
``
448
448
`/* dev_mode=1 is tested in test_init_dev_mode() */
`
449
449
``
`@@ -570,7 +570,7 @@ static int test_init_from_config(void)
`
570
570
`static void test_init_env_putenvs(void)
`
571
571
`{
`
572
572
`putenv("PYTHONHASHSEED=42");
`
573
``
`-
putenv("PYTHONMALLOC=malloc_debug");
`
``
573
`+
putenv("PYTHONMALLOC=malloc");
`
574
574
`putenv("PYTHONTRACEMALLOC=2");
`
575
575
`putenv("PYTHONPROFILEIMPORTTIME=1");
`
576
576
`putenv("PYTHONMALLOCSTATS=1");
`
`@@ -594,32 +594,45 @@ static void test_init_env_putenvs(void)
`
594
594
`}
`
595
595
``
596
596
``
``
597
`+
static int test_init_env(void)
`
``
598
`+
{
`
``
599
`+
/* Test initialization from environment variables */
`
``
600
`+
Py_IgnoreEnvironmentFlag = 0;
`
``
601
`+
test_init_env_putenvs();
`
``
602
`+
_testembed_Py_Initialize();
`
``
603
`+
dump_config();
`
``
604
`+
Py_Finalize();
`
``
605
`+
return 0;
`
``
606
`+
}
`
``
607
+
``
608
+
597
609
`static void test_init_env_dev_mode_putenvs(void)
`
598
610
`{
`
599
611
`test_init_env_putenvs();
`
600
``
`-
putenv("PYTHONMALLOC=malloc");
`
``
612
`+
putenv("PYTHONMALLOC=");
`
601
613
`putenv("PYTHONFAULTHANDLER=");
`
602
614
`putenv("PYTHONDEVMODE=1");
`
603
615
`}
`
604
616
``
605
617
``
606
``
`-
static int test_init_env(void)
`
``
618
`+
static int test_init_env_dev_mode(void)
`
607
619
`{
`
608
620
`/* Test initialization from environment variables */
`
609
621
`Py_IgnoreEnvironmentFlag = 0;
`
610
``
`-
test_init_env_putenvs();
`
``
622
`+
test_init_env_dev_mode_putenvs();
`
611
623
`_testembed_Py_Initialize();
`
612
624
`dump_config();
`
613
625
`Py_Finalize();
`
614
626
`return 0;
`
615
627
`}
`
616
628
``
617
629
``
618
``
`-
static int test_init_env_dev_mode(void)
`
``
630
`+
static int test_init_env_dev_mode_alloc(void)
`
619
631
`{
`
620
632
`/* Test initialization from environment variables */
`
621
633
`Py_IgnoreEnvironmentFlag = 0;
`
622
634
`test_init_env_dev_mode_putenvs();
`
``
635
`+
putenv("PYTHONMALLOC=malloc");
`
623
636
`_testembed_Py_Initialize();
`
624
637
`dump_config();
`
625
638
`Py_Finalize();
`
`@@ -700,6 +713,7 @@ static struct TestCase TestCases[] = {
`
700
713
` { "init_from_config", test_init_from_config },
`
701
714
` { "init_env", test_init_env },
`
702
715
` { "init_env_dev_mode", test_init_env_dev_mode },
`
``
716
`+
{ "init_env_dev_mode_alloc", test_init_env_dev_mode_alloc },
`
703
717
` { "init_dev_mode", test_init_dev_mode },
`
704
718
` { "init_isolated", test_init_isolated },
`
705
719
` { NULL, NULL }
`