https://github.com/python/cpython/commit/d8c20a504192f4d8bf2e51c92b47559a97f2b2b1
commit: d8c20a504192f4d8bf2e51c92b47559a97f2b2b1
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-08-07T06:56:22Z
summary:

[3.13] gh-75876: Correct the memory use declared by some bigmem tests 
(GH-155307) (GH-155314)

Measured with a limited address space and the peak RSS of the process:

* TupleTest.test_repeat_large_2 keeps 3 tuples of pointers alive, as its
  siblings do, but declared the count for a 32-bit build.
* The md5 tests hash the data and a io.BytesIO() copy of it.
* testDecompress4G keeps the data, the compressed and the decompressed
  bytes alive, and the decompressor grows its output buffer.
* test_huge_string_builtins uses 3 times the string size, not 2.
* test_large_subn uses a bit more than the 18 times it declared.
(cherry picked from commit e469fa9c8077345c75da6e39d40534e7a6fc5057)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

files:
M Lib/test/test_bigmem.py
M Lib/test/test_hashlib.py
M Lib/test/test_re.py
M Lib/test/test_tcl.py
M Lib/test/test_zlib.py

diff --git a/Lib/test/test_bigmem.py b/Lib/test/test_bigmem.py
index c9ab1c1de9e186..09879005f6b81e 100644
--- a/Lib/test/test_bigmem.py
+++ b/Lib/test/test_bigmem.py
@@ -901,7 +901,7 @@ def test_repeat_small(self, size):
     def test_repeat_large(self, size):
         return self.basic_test_repeat(size)
 
-    @bigmemtest(size=_1G - 1, memuse=12)
+    @bigmemtest(size=_1G - 1, memuse=pointer_size * 3)
     def test_repeat_large_2(self, size):
         return self.basic_test_repeat(size)
 
diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py
index 113178aee91a2f..424ebe1ed5af2f 100644
--- a/Lib/test/test_hashlib.py
+++ b/Lib/test/test_hashlib.py
@@ -609,12 +609,12 @@ def test_case_md5_2(self):
         )
 
     @unittest.skipIf(sys.maxsize < _4G + 5, 'test cannot run on 32-bit 
systems')
-    @bigmemtest(size=_4G + 5, memuse=1, dry_run=False)
+    @bigmemtest(size=_4G + 5, memuse=2, dry_run=False)
     def test_case_md5_huge(self, size):
         self.check('md5', b'A'*size, 'c9af2dff37468ce5dfee8f2cfc0a9c6d')
 
     @unittest.skipIf(sys.maxsize < _4G - 1, 'test cannot run on 32-bit 
systems')
-    @bigmemtest(size=_4G - 1, memuse=1, dry_run=False)
+    @bigmemtest(size=_4G - 1, memuse=2, dry_run=False)
     def test_case_md5_uintmax(self, size):
         self.check('md5', b'A'*size, '28138d306ff1b8281f1a9067e1a1a2b3')
 
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 809a7c565c09a6..96dd016b130aa5 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -2025,7 +2025,7 @@ def test_large_search(self, size):
 
     # The huge memuse is because of re.sub() using a list and a join()
     # to create the replacement result.
-    @bigmemtest(size=_2G, memuse=16 + 2)
+    @bigmemtest(size=_2G, memuse=16 + 3)
     def test_large_subn(self, size):
         # Issue #10182: indices were 32-bit-truncated.
         s = 'a' * size
diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py
index 47450d3fd5976f..82cd4311887210 100644
--- a/Lib/test/test_tcl.py
+++ b/Lib/test/test_tcl.py
@@ -781,7 +781,7 @@ def test_huge_string_call(self, size):
 
     @support.cpython_only
     @unittest.skipUnless(INT_MAX < PY_SSIZE_T_MAX, "needs UINT_MAX < SIZE_MAX")
-    @support.bigmemtest(size=INT_MAX + 1, memuse=2, dry_run=False)
+    @support.bigmemtest(size=INT_MAX + 1, memuse=3, dry_run=False)
     def test_huge_string_builtins(self, size):
         tk = self.interp.tk
         value = '1' + ' ' * size
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index 4d97fe56f3a094..32add7bc1e92f7 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -982,7 +982,7 @@ def testEOFError(self):
         self.assertRaises(EOFError, zlibd.decompress, b"")
 
     @support.skip_if_pgo_task
-    @bigmemtest(size=_4G + 100, memuse=3.3)
+    @bigmemtest(size=_4G + 100, memuse=4.5)
     def testDecompress4G(self, size):
         # "Test zlib._ZlibDecompressor.decompress() with >4GiB input"
         blocksize = min(10 * 1024 * 1024, size)

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to