Dieter Maurer added the comment:
The observation was caused by a bug which has been fixed in newer Python
versions (3.9+ if I remember correctly). `isAlive` was called on a
`_DummyThread` (while `_DummyThread` overides `is_alive` it had forgotten to
override `isAlive` as well).
--
Dieter Maurer added the comment:
Apparently, the explanation is not that easy: `_stop` first sets `_is_stopped`
to `True` and only then `_tstate_lock` to `None`. Therefore, the race should
not cause the `AssertionError`.
I observed the `AssertionError` in Python 3.6. The related `threading`
New submission from Dieter Maurer :
I have observed an `AssertionError (assert self._is_stopped)` in
`threading.Thread._wait_for_tstate_lock`. This indicates that Python's internal
state has been corrupted.
The analysis revealed the following race condition:
`_wait_for_tstate:lock` contains