mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-45522: Allow to disable freelists on build time (GH-29056)
Freelists for object structs can now be disabled. A new ``configure`` option ``--without-freelists`` can be used to disable all freelists except empty tuple singleton. Internal Py*_MAXFREELIST macros can now be defined as 0 without causing compiler warnings and segfaults. Signed-off-by: Christian Heimes <christian@python.org>
This commit is contained in:
parent
5a14f71fe8
commit
9942f42a93
15 changed files with 218 additions and 35 deletions
|
@ -825,7 +825,18 @@ class SysModuleTest(unittest.TestCase):
|
|||
from test.support.script_helper import assert_python_ok
|
||||
args = ['-c', 'import sys; sys._debugmallocstats()']
|
||||
ret, out, err = assert_python_ok(*args)
|
||||
self.assertIn(b"free PyDictObjects", err)
|
||||
|
||||
# Output of sys._debugmallocstats() depends on configure flags.
|
||||
# The sysconfig vars are not available on Windows.
|
||||
if sys.platform != "win32":
|
||||
with_freelists = sysconfig.get_config_var("WITH_FREELISTS")
|
||||
with_pymalloc = sysconfig.get_config_var("WITH_PYMALLOC")
|
||||
if with_freelists:
|
||||
self.assertIn(b"free PyDictObjects", err)
|
||||
if with_pymalloc:
|
||||
self.assertIn(b'Small block threshold', err)
|
||||
if not with_freelists and not with_pymalloc:
|
||||
self.assertFalse(err)
|
||||
|
||||
# The function has no parameter
|
||||
self.assertRaises(TypeError, sys._debugmallocstats, True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue