From 8dd49fe09fc4ac3b527914a0703c0dc0429aa125 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 2 Jun 2014 21:36:59 +0200 Subject: Issue #21639: Add a test to check that PyMem_Malloc(0) with tracemalloc enabled does not crash. --- Lib/test/test_tracemalloc.py | 6 ++++++ 1 file changed, 6 insertions(+) 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( -- cgit v0.12