summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-06-02 19:36:59 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-06-02 19:36:59 (GMT)
commit8dd49fe09fc4ac3b527914a0703c0dc0429aa125 (patch)
tree5d59d6e2142596aecd336b454e7b20f62fe54c1b
parent797bcb51d08991ac8a4e56d099083a5acfc3667c (diff)
downloadcpython-8dd49fe09fc4ac3b527914a0703c0dc0429aa125.zip
cpython-8dd49fe09fc4ac3b527914a0703c0dc0429aa125.tar.gz
cpython-8dd49fe09fc4ac3b527914a0703c0dc0429aa125.tar.bz2
Issue #21639: Add a test to check that PyMem_Malloc(0) with tracemalloc enabled
does not crash.
-rw-r--r--Lib/test/test_tracemalloc.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_tracemalloc.py b/Lib/test/test_tracemalloc.py
index c953885..33b0dc2 100644
--- a/Lib/test/test_tracemalloc.py
+++ b/Lib/test/test_tracemalloc.py
@@ -807,6 +807,12 @@ class TestCommandLine(unittest.TestCase):
b'number of frames',
stderr)
+ def test_pymem_alloc0(self):
+ # Issue #21639: Check that PyMem_Malloc(0) with tracemalloc enabled
+ # does not crash.
+ code = 'import _testcapi; _testcapi.test_pymem_alloc0(); 1'
+ assert_python_ok('-X', 'tracemalloc', '-c', code)
+
def test_main():
support.run_unittest(