GeezerVison is showing github.com — Update asyncio to 3.14.2 by youknowone · Pull Request #6902 · RustPython/RustPython
Conversation
youknowone
commented
Jan 30, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
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.
coderabbitai
Bot
commented
Jan 30, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
📝 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
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 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
Comment @coderabbitai help to get the list of available commands and usage tips.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
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:
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
📦 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:
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
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Feb 3, 2026
This was referenced Feb 16, 2026
This was referenced Mar 1, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
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.
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.
|