Skip to content

Commit 019c315

Browse files
authored
gh-129559: add bytearray.resize thread safety test for free-threading (#141739)
1 parent a3b78a3 commit 019c315

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Lib/test/test_bytes.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2655,6 +2655,10 @@ def zfill(b, a):
26552655
c = a.zfill(0x400000)
26562656
assert not c or c[-1] not in (0xdd, 0xcd)
26572657

2658+
def resize(b, a): # MODIFIES!
2659+
b.wait()
2660+
a.resize(10)
2661+
26582662
def take_bytes(b, a): # MODIFIES!
26592663
b.wait()
26602664
c = a.take_bytes()
@@ -2728,6 +2732,8 @@ def check(funcs, a=None, *args):
27282732
check([clear] + [startswith] * 10)
27292733
check([clear] + [strip] * 10)
27302734

2735+
check([clear] + [resize] * 10)
2736+
27312737
check([clear] + [take_bytes] * 10)
27322738
check([take_bytes_n] * 10, bytearray(b'0123456789' * 0x400))
27332739
check([take_bytes_n] * 10, bytearray(b'0123456789' * 5))

0 commit comments

Comments
 (0)