diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-05-17 15:20:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-17 15:20:52 +0200 |
commit | b16b4e45923f4e4dfd8e970ae4e6a934faf73b79 (patch) | |
tree | fb7b3abc251f148386efdad7a5cde5d13d157d38 /Lib/test/test_embed.py | |
parent | 80ed353329ef01ca6ab2056051fb999818a86215 (diff) | |
download | cpython-git-b16b4e45923f4e4dfd8e970ae4e6a934faf73b79.tar.gz |
bpo-36763: Add PyMemAllocatorName (GH-13387)
* Add PyMemAllocatorName enum
* _PyPreConfig.allocator type becomes PyMemAllocatorName, instead of
char*
* Remove _PyPreConfig_Clear()
* Add _PyMem_GetAllocatorName()
* Rename _PyMem_GetAllocatorsName() to
_PyMem_GetCurrentAllocatorName()
* Remove _PyPreConfig_SetAllocator(): just call
_PyMem_SetupAllocators() directly, we don't have do reallocate the
configuration with the new allocator anymore!
* _PyPreConfig_Write() parameter becomes const, as it should be in
the first place!
Diffstat (limited to 'Lib/test/test_embed.py')
-rw-r--r-- | Lib/test/test_embed.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 4012a389d7..92cc405859 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -13,6 +13,9 @@ import textwrap MS_WINDOWS = (os.name == 'nt') +PYMEM_ALLOCATOR_NOT_SET = 0 +PYMEM_ALLOCATOR_DEBUG = 2 +PYMEM_ALLOCATOR_MALLOC = 3 class EmbeddingTestsMixin: @@ -272,7 +275,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): # Mark config which should be get by get_default_config() GET_DEFAULT_CONFIG = object() DEFAULT_PRE_CONFIG = { - 'allocator': None, + 'allocator': PYMEM_ALLOCATOR_NOT_SET, 'coerce_c_locale': 0, 'coerce_c_locale_warn': 0, 'utf8_mode': 0, @@ -564,7 +567,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): def test_init_from_config(self): preconfig = { - 'allocator': 'malloc', + 'allocator': PYMEM_ALLOCATOR_MALLOC, 'utf8_mode': 1, } config = { @@ -608,7 +611,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): self.check_config("init_from_config", config, preconfig) INIT_ENV_PRECONFIG = { - 'allocator': 'malloc', + 'allocator': PYMEM_ALLOCATOR_MALLOC, } INIT_ENV_CONFIG = { 'use_hash_seed': 1, @@ -633,7 +636,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): def test_init_env_dev_mode(self): preconfig = dict(self.INIT_ENV_PRECONFIG, - allocator='debug') + allocator=PYMEM_ALLOCATOR_DEBUG) config = dict(self.INIT_ENV_CONFIG, dev_mode=1, warnoptions=['default']) @@ -641,7 +644,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): def test_init_env_dev_mode_alloc(self): preconfig = dict(self.INIT_ENV_PRECONFIG, - allocator='malloc') + allocator=PYMEM_ALLOCATOR_MALLOC) config = dict(self.INIT_ENV_CONFIG, dev_mode=1, warnoptions=['default']) @@ -649,7 +652,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): def test_init_dev_mode(self): preconfig = { - 'allocator': 'debug', + 'allocator': PYMEM_ALLOCATOR_DEBUG, } config = { 'faulthandler': 1, |