Repository navigation
Merged
Conversation
Exiting a section past a still-active inner one emitted its RuntimeWarning before recording the exit. With warnings configured as errors, common under pytest's filterwarnings = ["error"], the warning raised from __exit__, replaced the exception propagating from the timed block, and left the active stack pointing at the abandoned section. The exit is now recorded and the stack unwound before the warning is emitted. Clearing timings while a section is active leaves its children without a recorded parent. The report ordered them as roots but indented them by path length, beneath an unrelated section, and every total counted only single-element paths, so a periodic clear inside an outer section reported a total of 0 and 0.00% for everything. Totals now count every section without a recorded parent, the same roots the hierarchy ordering uses, and the report indents by tree depth. get_total_time, the report and the JSON total share one definition. Recording is untouched and the overhead benchmark is unchanged within noise.
Require hatchling>=1.27, the first release supporting the PEP 639 license-files metadata the project declares, and group Dependabot's monthly updates into one pull request per ecosystem.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
Two bug fixes found in a post-1.0 review, plus small packaging hardening. No API changes.
1. Warnings-as-errors re-corrupted the stack.
stop_timeremitted itsRuntimeWarningbefore recording the exit. Underfilterwarnings = ["error"](orpython -W error), the warning raised from__exit__, replaced the user's exception, and left the active stack pointing at the abandoned section. That is the exact failure 1.0.0 set out to fix. The exit is now recorded and the stack unwound first, then the warning is emitted.2. Clearing inside an outer section broke totals. The README recommends clearing periodically in long-running loops, which usually sit inside an outer section. The children then have no recorded parent, and the report showed:
Totals now count every section without a recorded parent (the same roots
_ordered_by_hierarchyalready used), and the report indents by tree depth instead of path length.get_total_time(), the report and the JSONtotal_timeshare one helper,_top_level_time. Category totals already handled this case.Packaging:
hatchling>=1.27(the first release with PEP 639license-files), and Dependabot groups monthly updates into one PR per ecosystem.Performance
Recording code is unchanged apart from the order of the warning branch. Overhead benchmark (
--number 100000 --repeat 9, CPython 3.11, macOS arm64), ns/op:All differences are within ±3%, which is run-to-run noise.
Checklist
uv run pytest --covpasses (96 tests, 100% statement and branch coverage)uv run ruff checkanduv run ruff format --checkpassuv run basedpyrightpasses (0 errors, 0 warnings)0.00%output and was corrected)CHANGELOG.mdupdated (as## [1.0.1])