Skip to content

Update asyncio task lifecycle and frame handling to Python 3.15.2 - #9910

Merged
youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:update/asyncio-remainder-3152-20261117
Nov 17, 2026
Merged

youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:update/asyncio-remainder-3152-20261117

Conversation

@youknowdot

@youknowdot youknowdot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Complete the adjacent Python-only asyncio task lifecycle and frame-formatting updates from CPython 3.15.2 in one batch:

  • Restore as_completed iteration accounting when a pending wait is cancelled.
  • Remove gather's awaited-by edges when a child terminates the gather, without an extra outer callback.
  • Do not report a shielded future's exception eagerly: its owner may still retrieve it. Unretrieved exceptions retain normal future-finalization reporting.
  • Handle frames with missing locations and retain complete function names in task tables.

Both production modules (tasks.py, tools.py) are byte-identical to canonical CPython 3.15.2. Tests were migrated with scripts/update_lib; no bespoke tests or Rust changes. The earlier local gather/shield mechanisms are superseded by the canonical implementations after their related canonical regressions passed.

Verification

  • RustPython tasks/tools/graph: 1,182 tests, 1 skipped, passed. The skip is CPython-specific GenericTaskTests.test_asyncio_module_compiled.
  • Existing preserved release binary (native baseline 0175f1a) executed the updated on-disk Lib; this is not a fresh main native build.
  • Canonical CPython 3.15.2 tasks/tools reference: 1,155 tests, passed.
  • Cancellation reproducer: both iterator forms returned only ['a'] on base Lib; updated Lib and canonical CPython return ['a', 'b'].
  • Normal commit hooks passed, including ruff format/check and redundant-test-patch check.

Explicitly deferred / not verified

  • The new canonical native test_task_created_during_thread_state_clear was tried separately and failed: its finalizer had not run by thread join (task is None). It is not imported in this Python-only batch; an explicit migration preservation block retains the existing native test scope. No new skip/xfail hides it. The initial full-canonical trial ran 1,183 tests with this sole failure; the final selected scope above passes.
  • No fresh workspace Rust/CAPI/Clippy, Windows/macOS runtime or performance tests locally. CI must be checked on the latest head; older-head results do not validate the expansion.

AI-assisted by OpenAI Codex (GPT-6.1).

…n 3.15.2

Use update_lib while preserving the existing gather and shield adaptations and native thread-state test scope.

Assisted-by: OpenAI Codex:GPT-6.1
@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

📦 Library Dependencies

The following Lib/ modules were modified. Here are their dependencies:

[x] lib: cpython/Lib/asyncio
[ ] test: cpython/Lib/test/test_asyncio (TODO: 2)

dependencies:

  • asyncio

dependent tests: (9 tests)

  • asyncio: test_asyncio test_concurrent_futures test_external_inspection test_inspect test_logging test_os test_pdb test_unittest
    • pdb: test_remote_pdb

Legend:

  • [+] path exists in CPython
  • [x] up-to-date, [ ] outdated

Preserve existing native thread-state scope while migrating the related task lifecycle tests. Both production modules now match CPython 3.15.2 exactly.

Assisted-by: OpenAI Codex:GPT-6.1
@youknowdot youknowdot changed the title Update asyncio cancellation and incomplete-frame handling to Python 3.15.2 Update asyncio task lifecycle and frame handling to Python 3.15.2 Nov 17, 2026
@codspeed

codspeed Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:update/asyncio-remainder-3152-20261117 (850f486) with main (4f7b57b)2

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (7abccf0) during the generation of this report, so 4f7b57b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@youknowone
youknowone marked this pull request as ready for review November 17, 2026 14:26
@youknowone
youknowone merged commit a7a8fab into RustPython:main Nov 17, 2026
22 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T14:33:14.245940Z 850f486 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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