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 — traverse for generator by youknowone · Pull Request #6760 · RustPython/RustPython

Conversation

@youknowone

@youknowone youknowone commented Jan 17, 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

  • Chores
    • Improved garbage collection handling for async generators, coroutines, and generators to enable more efficient memory management.

✏️ 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
@youknowone
traverse for generator
d30ca0d
@coderabbitai

coderabbitai Bot commented Jan 17, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR adds manual garbage collection traversal support by implementing the Traverse trait for async generators, coroutines, generators, and the core Coro struct, while marking their pyclass definitions with traverse = "manual" to enable explicit GC tracing of contained fields.

Changes

Cohort / File(s) Summary
Async Generator Traversal
crates/vm/src/builtins/asyncgenerator.rs
Added unsafe impl Traverse for PyAsyncGen, PyAsyncGenWrappedValue, PyAsyncGenASend, PyAsyncGenAThrow, and PyAnextAwaitable; each implementation traverses its inner fields (Coro, finalizer, wrapped values). Updated all five pyclass definitions with traverse = "manual".
Coroutine and Wrapper Traversal
crates/vm/src/builtins/coroutine.rs
Added unsafe impl Traverse for PyCoroutine (delegates to self.inner) and PyCoroutineWrapper (delegates to self.coro). Updated both pyclass definitions with traverse = "manual".
Generator Traversal
crates/vm/src/builtins/generator.rs
Added unsafe impl Traverse for PyGenerator delegating to self.inner.traverse(tracer_fn). Updated pyclass definition with traverse = "manual". Added imports for Traverse and TraverseFn.
Core Coro Traversal
crates/vm/src/coroutine.rs
Added unsafe impl Traverse for Coro struct that traverses frame, name, qualname, and exception fields.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • sys.set_asyncgen_hook #6439 — Modifies the same async generator types (PyAsyncGen, PyAnextAwaitable, PyAsyncGenASend/AThrow/WrappedValue) with lifecycle methods and state management
  • PyAnextAwaitable  #6427 — Introduces or modifies PyAnextAwaitable and async generator types alongside GC traversal additions

Poem

🐰 A rabbit hops through memory lanes,
Tracing coroutines' flowing chains,
Generators yield their GC care,
Traverse marks what's hiding there!
Cleanup bound, no leaks remain ✨

✨ Finishing touches
  • 📝 Generate docstrings

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.

@github-actions
Auto-format: cargo fmt --all
1d66268
@github-actions

github-actions Bot commented Jan 17, 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 traverse
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 January 18, 2026 00:35
@youknowone
youknowone merged commit abea6bd into RustPython:main Jan 18, 2026
11 of 13 checks passed

Uh oh!

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

@youknowone
youknowone deleted the traverse branch January 18, 2026 00:36
@coderabbitai coderabbitai Bot mentioned this pull request Jan 22, 2026
Update types from v3.14.2 #6833
Merged
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.