https://github.com/python/cpython/commit/019c315a8e52978da67a3108e441ed5ee376f504
commit: 019c315a8e52978da67a3108e441ed5ee376f504
branch: main
author: Cody Maloney <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2025-11-21T23:42:22+05:30
summary:

gh-129559: add `bytearray.resize` thread safety test for free-threading  
(#141739)

files:
M Lib/test/test_bytes.py

diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index 7ca38bb8c8421e..a6cf899fa51e75 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -2655,6 +2655,10 @@ def zfill(b, a):
             c = a.zfill(0x400000)
             assert not c or c[-1] not in (0xdd, 0xcd)
 
+        def resize(b, a):  # MODIFIES!
+            b.wait()
+            a.resize(10)
+
         def take_bytes(b, a):  # MODIFIES!
             b.wait()
             c = a.take_bytes()
@@ -2728,6 +2732,8 @@ def check(funcs, a=None, *args):
         check([clear] + [startswith] * 10)
         check([clear] + [strip] * 10)
 
+        check([clear] + [resize] * 10)
+
         check([clear] + [take_bytes] * 10)
         check([take_bytes_n] * 10, bytearray(b'0123456789' * 0x400))
         check([take_bytes_n] * 10, bytearray(b'0123456789' * 5))

_______________________________________________
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