Skip to content

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
TTsangSC:async-gen-test-refcount-fix
Feb 18, 2026
Merged

FIX: test for async-generator ref-counting behavior (un-)broken by 3.13.12 and 3.14.3#421
Erotemic merged 1 commit intopyutils:mainfrom
TTsangSC:async-gen-test-refcount-fix

Conversation

@TTsangSC
Copy link
Collaborator

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.monitoring to identify 3.12+, we now consult sys.version_info to explicitly identify the Python (patch) versions where the ref-count bug is present.

@codecov
Copy link

codecov bot commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.06%. Comparing base (60e928f) to head (b6ba04b).
⚠️ Report is 32 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8292b11...b6ba04b. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Erotemic Erotemic merged commit 0c769c1 into pyutils:main Feb 18, 2026
45 checks passed
@TTsangSC TTsangSC deleted the async-gen-test-refcount-fix branch February 18, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments