Created
March 3, 2025 07:34
-
-
Save duaneg/59ec54d52e19a7ad52d8c4d82ef8e9fb to your computer and use it in GitHub Desktop.
Repro for python gh-129748
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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