Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add gc callback mutation race regression test
  • Loading branch information
dzaramelcone committed May 29, 2026
commit c2b7dbe6f66e07672833692c1ed8caaf401f5b3c
22 changes: 22 additions & 0 deletions Lib/test/test_free_threading/test_gc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import threading
from threading import Thread
import time
from unittest import TestCase
import gc

Expand Down Expand Up @@ -94,6 +95,27 @@ def evil():
thread.start()
thread.join()

def test_gc_callbacks_race_with_mutation(self):
def collect():
b.wait()
while not stop.is_set():
gc.collect()

def mutate():
b.wait()
while not stop.is_set():
gc.callbacks[:] = [lambda *_: _ for _ in range(16)]
time.sleep(0)
gc.callbacks.clear()

threads = [threading.Thread(target=f) for f in (collect, mutate) * 4]
b = threading.Barrier(len(threads) + 1)
stop = threading.Event()

with threading_helper.start_threads(threads, stop.set):
b.wait()
time.sleep(0.2)


if __name__ == "__main__":
unittest.main()
Loading