FIX: test for async-generator ref-counting behavior (un-)broken by 3.13.12 and 3.14.3#421
Merged
Erotemic merged 1 commit intopyutils:mainfrom Feb 18, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #421 +/- ##
==========================================
+ Coverage 87.56% 89.06% +1.49%
==========================================
Files 18 20 +2
Lines 1641 2258 +617
Branches 348 474 +126
==========================================
+ Hits 1437 2011 +574
- Misses 149 184 +35
- Partials 55 63 +8 see 4 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
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.
The test
tests/test_line_profiler.py::test_async_gen_decorator[False]checks the ref-count of the async-gen function before and after profiling, and expects (i.e. XFails on) inconsistencies in Python 3.12+ because of a previously-unidentified bug.Said bug turned out to have already been documented for years in python/cpython#100964, received a fix in the form of python/cpython#141112, and patched into Python 3.14.3, 3.13.3, and of course the 3.15 alpha less than two weeks ago. This resulted in some recent pipelines "consistently inconsistently" failing between similar jobs on the aforementioned test, because depending on the platforms the exact Python patch version pulled can vary.
This PR fixes the tests by updating the version check: instead of checking for the existence of
sys.monitoringto identify 3.12+, we now consultsys.version_infoto explicitly identify the Python (patch) versions where the ref-count bug is present.