Skip to content

Instantly share code, notes, and snippets.

@duaneg
Created March 3, 2025 07:34
Show Gist options
  • Save duaneg/59ec54d52e19a7ad52d8c4d82ef8e9fb to your computer and use it in GitHub Desktop.
Save duaneg/59ec54d52e19a7ad52d8c4d82ef8e9fb to your computer and use it in GitHub Desktop.
Repro for python gh-129748
import threading
import time
x = "abc"
end = threading.Event()
def alloc():
global x
while not end.is_set():
x = str(id(x))
def read():
global x
while not end.is_set():
hash(x)
t1 = threading.Thread(target=alloc)
t2 = threading.Thread(target=read)
t1.start()
t2.start()
time.sleep(0.1)
end.set()
t2.join()
t1.join()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment