| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
COVERAGE_SYSMON_LOG=1 re-entered sys.monitoring from log() file I/O, which hung test_stdlib[True]. Ignore nested log calls on the same thread.
When COVERAGE_SYSMON_LOG=1, sys.monitoring is replaced by a LoggingWrapper whose __getattr__ wrapped every attribute access as a function. Reading constants like COVERAGE_ID then returned a function instead of the int, so SysMonitor.start() crashed with "TypeError: '<=' not supported between instances of 'function' and 'int'". Return non-callable attributes unwrapped; only callables are logged. This is required by the new stdlib-logging test that enables the debug log (coveragepy#2087). Signed-off-by: SeaStar Deng <172368758@qq.com>
With COVERAGE_SYSMON_LOG=1, logging a sys.monitoring call inside SysMonitor.start() (which holds self.lock, added for free-threading in 8b9cecc) triggers PY_START events; the sysmon_py_start callback then re-enters the same non-reentrant Lock in the same thread and deadlocks. An RLock lets the callback proceed in the lock-holding thread while still excluding other threads. Verified with the new test_sysmon_log_does_not_deadlock_on_stdlib on CPython 3.14. Signed-off-by: SeaStar Deng <172368758@qq.com>
The debug logger opened "/tmp/foo.out" unconditionally; on Windows CI runners the /tmp directory does not exist, so test_sysmon_log_does_not_deadlock_on_stdlib failed with FileNotFoundError before the deadlock could even be exercised. Resolve the log path through tempfile.gettempdir(), which always exists. Signed-off-by: SeaStar Deng <172368758@qq.com>
Resolve CHANGES.rst conflict: keep upstream's new Unreleased entries and append the issue 2087 note plus its link target.
|
Branch updated: it had drifted out of date with main and CHANGES.rst no longer merged cleanly (the Unreleased section gained several new entries). I merged current main into the branch and resolved that conflict by keeping all of the upstream entries and appending the issue 2087 note (plus its link target) at the end of the list. No code changes were needed: coverage/sysmon.py and tests/test_sysmon.py merged cleanly, and the upstream MonitorReturn = DISABLE_TYPE | None modernization is preserved. The diff against main is still just the three files. CI is re-running on the new head. |
Sorry, something went wrong.
|
All CI checks are now green on the rebased branch (merge commit d88cf7cc, which brings in latest main): Dependency Review, CodeQL, Coverage, Tests, and Quality all pass. The only change beyond the original 2-file source diff is CHANGES.rst (conflict resolution — the issue 2087 entry is appended after the upstream Unreleased entries, no code semantics changed). The PR is now mergeable and ready for review/merge. Thanks! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #2087.
COVERAGE_SYSMON_LOG=1 writes debug output from log() with ordinary file I/O and a stack walk. Those operations re-enter sys.monitoring while the sysmon core is measuring the standard library, so test_stdlib[True] hangs.
log() now uses a thread-local guard and drops nested calls on the same thread. The first-thread banner is written in the same call instead of recursing into log().
A subprocess regression test runs a cover_pylib=True measurement with COVERAGE_SYSMON_LOG=1 and COVERAGE_CORE=sysmon.