]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46263: FreeBSD 14.0 jemalloc workaround for junk bytes of freed memory (GH-30434)
authorChristian Heimes <christian@python.org>
Thu, 6 Jan 2022 15:14:49 +0000 (17:14 +0200)
committerGitHub <noreply@github.com>
Thu, 6 Jan 2022 15:14:49 +0000 (07:14 -0800)
Automerge-Triggered-By: GH:tiran
Lib/test/test_capi.py
Misc/NEWS.d/next/Tests/2022-01-06-15-45-34.bpo-46263.bJXek6.rst [new file with mode: 0644]

index ecf3aa34ede7c17f7f219e36f1bdc5dcaa3cc35f..e246c36de01cd22c828421748b0c173a287c07da 100644 (file)
@@ -857,8 +857,13 @@ class PyMemDebugTests(unittest.TestCase):
 
     def check(self, code):
         with support.SuppressCrashReport():
-            out = assert_python_failure('-c', code,
-                                        PYTHONMALLOC=self.PYTHONMALLOC)
+            out = assert_python_failure(
+                '-c', code,
+                PYTHONMALLOC=self.PYTHONMALLOC,
+                # FreeBSD: instruct jemalloc to not fill freed() memory
+                # with junk byte 0x5a, see JEMALLOC(3)
+                MALLOC_CONF="junk:false",
+            )
         stderr = out.err
         return stderr.decode('ascii', 'replace')
 
diff --git a/Misc/NEWS.d/next/Tests/2022-01-06-15-45-34.bpo-46263.bJXek6.rst b/Misc/NEWS.d/next/Tests/2022-01-06-15-45-34.bpo-46263.bJXek6.rst
new file mode 100644 (file)
index 0000000..0334af4
--- /dev/null
@@ -0,0 +1,2 @@
+Fix test_capi on FreeBSD 14-dev: instruct jemalloc to not fill freed memory
+with junk byte.