8000 gh-130163-repro-gil.py · GitHub
[go: up one dir, main page]

Skip to content

Instantly share code, notes, and snippets.

@colesbury
Created February 16, 2025 17:35
Show Gist options
  • Save colesbury/c48f50e95d5d68e24814a56e2664e587 to your computer and use it in GitHub Desktop.
Save colesbury/c48f50e95d5d68e24814a56e2664e587 to your computer and use it in GitHub Desktop.
from contextlib import redirect_stdout
from io import StringIO
from threading import Thread
import time
class Foo:
def __repr__(self):
time.sleep(0.2)
return "Foo"
def thread1():
text = StringIO()
with redirect_stdout(text):
time.sleep(0.2)
def main():
t1 = Thread(target=thread1, args=())
t1.start()
time.sleep(0.1)
print(Foo())
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
0