]> granicus.if.org Git - python/commitdiff
Issue #21639: Add a test to check that PyMem_Malloc(0) with tracemalloc enabled
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 2 Jun 2014 19:36:59 +0000 (21:36 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 2 Jun 2014 19:36:59 +0000 (21:36 +0200)
does not crash.

Lib/test/test_tracemalloc.py

index c953885fc59cbe2772c4650c53326e25a25a4749..33b0dc2b0eadd90cad16e1304211ff3c7190012b 100644 (file)
@@ -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(