Crash report
What happened?
When I run this code on Python 3.11 it runs fine, but if I import typing_minimal (or typing) in reader.py I get this error:
Fatal Python error: _enter_buffered_busy: could not acquire lock for <_io.BufferedReader name='<stdin>'> at interpreter shutdown, possibly due to daemon threads
Python runtime state: finalizing (tstate=0x00007fff13ab6960)
Current thread 0x00003944 (most recent call first):
<no Python frame>
main.py:
importreaderfromtyping_minimalimportGeneric, TypeVarVALUE=TypeVar("VALUE")
classBaseClass(Generic[VALUE]):
def__init__(self):
passclassSubClass(BaseClass[VALUE]):
passreader.thread.start()reader.py:
fromsysimportstdinfromthreadingimportThread# BUG: I get an error when I assign this:# typing_minimal = __import__("typing_minimal")thread=Thread(target=lambda: stdin.buffer.read(), daemon=True)typing_minimal.py:
fromfunctoolsimportlru_cache, wrapsdef_tp_cache(func):
cached=lru_cache()(func)
@wraps(func)definner(*args, **kwds):
returncached(*args, **kwds)
returninnerclassTypeVar:
def__init__(self, _):
passclass_GenericAlias:
def__init__(self, origin):
self.origin=origindef__eq__(self, other):
ifisinstance(other, _GenericAlias):
returnself.originisother.originreturnNotImplementeddef__hash__(self):
returnhash(self.origin)
def__mro_entries__(self, _):
return (self.origin,)
classGeneric:
@_tp_cachedef__class_getitem__(cls, *_):
return_GenericAlias(cls)
I don't understand how this is even possible.
CPython versions tested on:
3.11
Operating systems tested on:
macOS, Windows
Crash report
What happened?
When I run this code on Python 3.11 it runs fine, but if I import
typing_minimal(ortyping) inreader.pyI get this error:main.py:
reader.py:
typing_minimal.py:
I don't understand how this is even possible.
CPython versions tested on:
3.11
Operating systems tested on:
macOS, Windows