Issue 23768: assert on getting the representation of a thread in atexit function (original) (raw)
The following 'thread_repr.py' script:
import threading, atexit
def foo(): print(threading.currentThread())
atexit.register(foo)
gives the following output:
Error in atexit._run_exitfuncs: Traceback (most recent call last): File "thread_repr.py", line 4, in foo print(threading.currentThread()) File "/usr/local/lib/python3.5/threading.py", line 826, in repr self.is_alive() # easy way to get ._is_stopped set when appropriate File "/usr/local/lib/python3.5/threading.py", line 1122, in is_alive self._wait_for_tstate_lock(False) File "/usr/local/lib/python3.5/threading.py", line 1078, in _wait_for_tstate_lock assert self._is_stopped AssertionError