You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This program (minimized from Zulip’s TimeoutTestCase.test_timeout_warn) succeeds in Python 3.10 without coverage, 3.10 with coverage, and 3.11 without coverage, but it fails in 3.11 with coverage.
The program spawns sleep(1) in a thread, then uses the Python C API to raise an asynchronous exception within it, which has no immediate effect since it’s still sleeping. Both thread.is_alive() calls should immediately return True. But in Python 3.11 with coverage, it seems the first thread.is_alive() call unexpectedly blocks until the thread’s sleep(1) finishes before returning, so the second thread.is_alive() call returns False.
A git bisect of Python shows that this started failing with
I have no idea what that change in CPython did, or how coverage affects it. If you have any more details about why this might be happening, I'd appreciate them.
I also don't understand why ctypes is needed to demonstrate the problem.
Describe the bug
This program (minimized from Zulip’s
TimeoutTestCase.test_timeout_warn
) succeeds in Python 3.10 withoutcoverage
, 3.10 withcoverage
, and 3.11 withoutcoverage
, but it fails in 3.11 withcoverage
.The program spawns
sleep(1)
in a thread, then uses the Python C API to raise an asynchronous exception within it, which has no immediate effect since it’s still sleeping. Boththread.is_alive()
calls should immediately returnTrue
. But in Python 3.11 withcoverage
, it seems the firstthread.is_alive()
call unexpectedly blocks until the thread’ssleep(1)
finishes before returning, so the secondthread.is_alive()
call returnsFalse
.A
git bisect
of Python shows that this started failing withTo Reproduce
Run
python3.11 -m coverage run test.py
. I’m using the latestcoverage==7.2.5
on Linux x86-64 (NixOS 23.05).The text was updated successfully, but these errors were encountered: