GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Update asyncio to 3.14.2 by youknowone · Pull Request #6902 · RustPython/RustPython

Conversation

@youknowone

@youknowone youknowone commented Jan 30, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Introduced remote debugging module enabling introspection of frames, tasks, coroutines, and thread information.
    • Added f_generator attribute to frames for generator-to-frame introspection.
    • Enhanced asyncio fork handling for proper state reset in child processes.
  • Bug Fixes

    • Improved async generator state management and error recovery.
    • Fixed resource cleanup for generators and coroutines on destruction.
    • Enhanced recursive representation protection for asyncio Future and Task objects.

✏️ Tip: You can customize this high-level summary in your review settings.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@coderabbitai

coderabbitai Bot commented Jan 30, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Implements frame-generator bidirectional references via PyAtomicBorrow to break reference cycles, adds Drop implementations for cleanup, enhances asyncio with fork handling and guarded representations, introduces _remote_debugging module, and exposes frame generator introspection.

Changes

Cohort / File(s) Summary
Asyncio Fork Handling & Repr Guarding
crates/stdlib/src/_asyncio.rs
Added Unix-only _on_fork function to reset per-thread task state and module-level _current_tasks dict; introduced ReprGuard protection for recursive Future/Task reprs; added qualname getters to TaskStepMethWrapper, TaskWakeupMethWrapper, and PyTask; enhanced per-thread task tracking and cross-thread awaited_by introspection.
Remote Debugging Module
crates/stdlib/src/_remote_debugging.rs, crates/stdlib/src/lib.rs
Introduced new _remote_debugging module with struct sequences (FrameInfo, TaskInfo, CoroInfo, ThreadInfo, AwaitedInfo) and RemoteUnwinder placeholder class; integrated module into stdlib initialization pipeline.
Frame-Generator Bidirectional References
crates/vm/src/object/ext.rs, crates/vm/src/frame.rs
Added PyAtomicBorrow non-owning atomic reference type to break generator↔frame cycles; implemented set_generator/clear_generator methods on Frame; introduced f_generator getter; refactored yield_from_target to use try_lock-based local execution path.
Generator & Coroutine Lifecycle
crates/vm/src/builtins/generator.rs, crates/vm/src/builtins/coroutine.rs, crates/vm/src/builtins/function.rs
Added Drop implementations for PyGenerator and PyCoroutine to clear frames; updated invoke_with_locals to register created generators on frames via set_generator.
Async Generator State Management
crates/vm/src/builtins/asyncgenerator.rs
Refined state machine transitions for await operations; replaced close() with set_closed() in error paths to avoid full close semantics; extended close methods to accept VirtualMachine; added Drop implementation for frame cleanup; improved error message formatting.

Sequence Diagram(s)

sequenceDiagram
    participant Module as Module Init
    participant ForkHook as Fork Hook Registry
    participant Parent as Parent Process
    participant Fork as Fork System Call
    participant Child as Child Process
    participant OnFork as _on_fork Handler
    participant State as Asyncio State

    Module->>ForkHook: Register _on_fork (Unix only)
    Parent->>Fork: fork()
    Fork->>Parent: Continue with child PID
    Fork->>Child: New process created
    Child->>OnFork: Invoke registered hook
    OnFork->>State: Clear per-thread running loop
    OnFork->>State: Clear per-thread running task
    OnFork->>State: Reset _current_tasks dict
    State-->>Child: Clean asyncio state
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~65 minutes

Possibly related PRs

  • fix asyncgen finalizer #6761 — Directly modifies async generator finalization and close/set_closed semantics in the same file with overlapping state handling logic.
  • Upgrade threading to 3.13.11; sys.setprofile & impl more threading #6691 — Implements post-fork child handling and per-thread async/frame state reset, closely aligned with the fork handling additions.
  • Add _asyncio and add test_asyncio  #6838 — Touches _asyncio module with asyncio-related test and module infrastructure changes affecting the same module.

Suggested reviewers

  • ShaharNaveh
  • fanninpm
  • coolreader18

Poem

🐰 The frames and generators dance in pairs,
Yet cycles threaten their affair—
A borrowed reference breaks the knot,
While forks reset what should be forgot.
In Drop we trust, and state's cleaned bright,
The rabbit's work makes asyncio right! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 43.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Update asyncio to 3.14.2' is vague and generic. While it mentions version 3.14.2, the changeset includes substantial additions beyond a simple dependency update: new remote debugging infrastructure, frame-to-generator linking via PyAtomicBorrow, async generator lifecycle fixes, and comprehensive asyncio task/fork management. Clarify the title to reflect the main technical changes, such as 'Add frame-to-generator linking and remote debugging scaffolding' or 'Refactor asyncio task lifecycle and generator frame management'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands and usage tips.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowone
youknowone force-pushed the asyncio branch from 4d6dbf7 to 99b7949 Compare January 30, 2026 15:43
@fanninpm fanninpm mentioned this pull request Jan 30, 2026
Upgrade Python libraries and test from Python 3.14 #6839
Open
@youknowone
youknowone force-pushed the asyncio branch from 99b7949 to 8de8ce2 Compare January 30, 2026 21:39
@youknowone

youknowone commented Jan 31, 2026

Copy link
Copy Markdown
Member Author

follow up #6601

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowone
youknowone force-pushed the asyncio branch 5 times, most recently from 7735700 to 7ab8d00 Compare February 1, 2026 10:29
@github-actions

github-actions Bot commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

Code has been automatically formatted

The code in this PR has been formatted using:

  • cargo fmt --all
    Please pull the latest changes before pushing again:
git pull origin asyncio
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowone
youknowone force-pushed the asyncio branch 3 times, most recently from 8794426 to 7b33e16 Compare February 1, 2026 15:18
youknowone and others added 8 commits February 2, 2026 00:43
@youknowone
impl more _asyncio
fe40dd3
CPython Developers @youknowone
Update asyncio from v3.14.2
b83d155
@youknowone
keycert3
085f517
@youknowone
mark failures
963261c
@youknowone
mark test failures
9a9426e
@youknowone
Fix asyncgen close
abd1daa
@youknowone
PyAtomicBorrow
80929f4
@youknowone
generator is borrowed
7258a4a
@youknowone
youknowone force-pushed the asyncio branch from 7b33e16 to 7258a4a Compare February 1, 2026 15:43
@github-actions

github-actions Bot commented Feb 1, 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: 37)

dependencies:

  • asyncio

dependent tests: (8 tests)

  • asyncio: test_asyncio test_builtin test_contextlib_async test_inspect test_logging test_os test_sys_settrace test_unittest

Legend:

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowone
youknowone marked this pull request as ready for review February 1, 2026 16:55
@youknowone
youknowone merged commit d1b55f5 into RustPython:main Feb 1, 2026
14 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@youknowone
youknowone deleted the asyncio branch February 1, 2026 23:04
This was referenced Feb 3, 2026
Update faulthandler to 3.14.2 #6949
Merged
Fix traceback, syntax errors, and exception handling #7015
Merged
no_std clippy #7043
Merged
This was referenced Feb 16, 2026
Optimize coroutine exception handling and fix gen_throw traceback #7166
Merged
more algorithm-independent GC infra #7194
Merged
This was referenced Mar 1, 2026
Implement PyStackRef borrowed stack references for LOAD_FAST_BORROW #7290
Merged
Remove Frame mutex and use DataStack bump allocator for LocalsPlus #7333
Merged
More fork safety #7380
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Aug 14, 2026
Per-interpreter runtime state and a process-wide GC stop-the-world #8517
Merged
youknowone added a commit that referenced this pull request Sep 16, 2026
@youknowone
Merge pull request #6902 from youknowone/asyncio
1cfa96c
Update asyncio to 3.14.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@youknowone
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.