[3.7] bpo-36611: Fix test_sys.test_getallocatedblocks() (GH-12797) by miss-islington · Pull Request #12801 · python/cpython (original) (raw)

Fix test_sys.test_getallocatedblocks() when tracemalloc is enabled.
If the name of Python memory allocators cannot get read, consider
that pymalloc is disabled.

Fix the following error:

./python -X tracemalloc -m test test_sys -v -m test_getallocatedblocks

ERROR: test_getallocatedblocks (test.test_sys.SysModuleTest)

Traceback (most recent call last):
File "Lib/test/test_sys.py", line 770, in test_getallocatedblocks
alloc_name = _testcapi.pymem_getallocatorsname()
RuntimeError: cannot get allocators name
(cherry picked from commit 9b8314c)

Co-authored-by: Victor Stinner vstinner@redhat.com

https://bugs.python.org/issue36611