We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2511674 commit 1ac4fd9Copy full SHA for 1ac4fd9
1 file changed
Lib/test/test_bytes.py
@@ -2908,6 +2908,19 @@ def check(funcs, it):
2908
check([iter_next] + [iter_reduce] * 10, iter(ba)) # for tsan
2909
check([iter_next] + [iter_setstate] * 10, iter(ba)) # for tsan
2910
2911
+ def test_free_threading_bytearray_resize(self):
2912
+ def resize_stress(ba):
2913
+ for _ in range(100_000):
2914
+ try:
2915
+ ba.resize(10_000)
2916
+ ba.resize(1)
2917
+ except (BufferError, ValueError):
2918
+ pass
2919
+
2920
+ ba = bytearray(100)
2921
+ threads = [threading.Thread(target=resize_stress, args=(ba,)) for _ in range(4)]
2922
+ for t in threads: t.start()
2923
+ for t in threads: t.join()
2924
2925
if __name__ == "__main__":
2926
unittest.main()
0 commit comments