summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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(