MCPcopy Index your code
hub / github.com/python/cpython / test_free_threading_bytearray

Method test_free_threading_bytearray

Lib/test/test_bytes.py:2530–2885  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2528 @threading_helper.reap_threads
2529 @threading_helper.requires_working_threading()
2530 def test_free_threading_bytearray(self):
2531 # Test pretty much everything that can break under free-threading.
2532 # Non-deterministic, but at least one of these things will fail if
2533 # bytearray module is not free-thread safe.
2534
2535 def clear(b, a, *args): # MODIFIES!
2536 b.wait()
2537 try: a.clear()
2538 except BufferError: pass
2539
2540 def clear2(b, a, c): # MODIFIES c!
2541 b.wait()
2542 try: c.clear()
2543 except BufferError: pass
2544
2545 def pop1(b, a): # MODIFIES!
2546 b.wait()
2547 try: a.pop()
2548 except IndexError: pass
2549
2550 def append1(b, a): # MODIFIES!
2551 b.wait()
2552 a.append(0)
2553
2554 def insert1(b, a): # MODIFIES!
2555 b.wait()
2556 a.insert(0, 0)
2557
2558 def extend(b, a): # MODIFIES!
2559 c = bytearray(b'0' * 0x400000)
2560 b.wait()
2561 a.extend(c)
2562
2563 def remove(b, a): # MODIFIES!
2564 c = ord('0')
2565 b.wait()
2566 try: a.remove(c)
2567 except ValueError: pass
2568
2569 def reverse(b, a): # modifies inplace
2570 b.wait()
2571 a.reverse()
2572
2573 def reduce(b, a):
2574 b.wait()
2575 a.__reduce__()
2576
2577 def reduceex2(b, a):
2578 b.wait()
2579 a.__reduce_ex__(2)
2580
2581 def reduceex3(b, a):
2582 b.wait()
2583 c = a.__reduce_ex__(3)
2584 assert not c[1] or 0xdd not in c[1][0]
2585
2586 def count0(b, a):
2587 b.wait()

Callers

nothing calls this directly

Calls 2

maketransMethod · 0.80
checkFunction · 0.70

Tested by

no test coverage detected