Skip to content
Prev Previous commit
Next Next commit
Merge branch 'main' into gh-137400-now-with-fewer-crashes
  • Loading branch information
colesbury committed Aug 11, 2025
commit a1d8760f3613f05042404d33702f834520a329ce
33 changes: 33 additions & 0 deletions Lib/test/test_free_threading/test_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,39 @@ def during_threads(self):
self.set = not self.set


class SetProfileAllMultiThreaded(TestCase):
def test_profile_all_threads(self):
done = threading.Event()

def func():
pass

def bg_thread():
while not done.is_set():
func()
func()
func()
func()
func()

def my_profile(frame, event, arg):
return None

bg_threads = []
for i in range(10):
t = threading.Thread(target=bg_thread)
t.start()
bg_threads.append(t)

for i in range(100):
threading.setprofile_all_threads(my_profile)
threading.setprofile_all_threads(None)

done.set()
for t in bg_threads:
t.join()


class TraceBuf:
def __init__(self):
self.traces = []
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.