[Python-checkins] [3.9] bpo-46263: FreeBSD 14.0 jemalloc workaround for junk bytes of freed memory (GH-30434) (GH-30437)

tiran webhook-mailer at python.org
Thu Jan 6 10:52:25 EST 2022


https://github.com/python/cpython/commit/b259015c1079744dbe3d58bd4c27757a6df9d1c6
commit: b259015c1079744dbe3d58bd4c27757a6df9d1c6
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: tiran <christian at python.org>
date: 2022-01-06T16:52:21+01:00
summary:

[3.9] bpo-46263: FreeBSD 14.0 jemalloc workaround for junk bytes of freed memory (GH-30434) (GH-30437)

Co-authored-by: Christian Heimes <christian at python.org>

files:
A Misc/NEWS.d/next/Tests/2022-01-06-15-45-34.bpo-46263.bJXek6.rst
M Lib/test/test_capi.py

diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index 87f327414b54e..72c648f54d8b7 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -763,8 +763,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
index 0000000000000..0334af4e3cbe8
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2022-01-06-15-45-34.bpo-46263.bJXek6.rst
@@ -0,0 +1,2 @@
+Fix test_capi on FreeBSD 14-dev: instruct jemalloc to not fill freed memory
+with junk byte.



More information about the Python-checkins mailing list