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 — Add garbage collection c-api by bschoenmaeckers · Pull Request #8239 · RustPython/RustPython

Conversation

@bschoenmaeckers

@bschoenmaeckers bschoenmaeckers commented Jul 8, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added support for additional object and garbage-collection APIs.
    • Exposed new memory allocation helpers for object-related use cases.
    • Made object finalization status available through the public API.

Sorry, something went wrong.

Uh oh!

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

All reactions
@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: e0a98f00-9d24-4f0f-9bc1-8c0d236cf7b5

📥 Commits

Reviewing files that changed from the base of the PR and between c41180d and 7e34cc2.

📒 Files selected for processing (3)
  • crates/capi/src/lib.rs
  • crates/capi/src/objimpl.rs
  • crates/vm/src/object/core.rs

📝 Walkthrough

Walkthrough

Adds a new public objimpl module in the capi crate providing C-ABI-compatible functions for GC object tracking, GC collection control, and raw memory allocation, delegating to the VM's GC state and memory routines. Also makes PyObject::gc_finalized publicly visible to support this.

Changes

objimpl C-API module

Layer / File(s) Summary
Module wiring and gc_finalized visibility
crates/capi/src/lib.rs, crates/vm/src/object/core.rs
Registers the new objimpl module and changes PyObject::gc_finalized visibility from pub(crate) to pub.
GC tracking and control extern functions
crates/capi/src/objimpl.rs
Adds PyObject_GC_Track, PyObject_GC_UnTrack, PyObject_GC_IsTracked, PyObject_GC_IsFinalized operating on GC state via with_vm, plus PyGC_Collect, PyGC_Enable, PyGC_Disable, PyGC_IsEnabled.
Memory allocation wrappers
crates/capi/src/objimpl.rs
Adds PyObject_Malloc, PyObject_Calloc, PyObject_Realloc, PyObject_Free delegating to PyMem_* allocator functions.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

  • RustPython/RustPython#6910: Extends the GC module/API and gc_state/PyObject GC-finalized support used by the new C-API GC hooks.
  • RustPython/RustPython#6929: New PyObject_GC_IsFinalized C-ABI hook depends on PyObject finalization state wired in this related PR.
  • RustPython/RustPython#6994: Makes PyObject::gc_finalized public, directly supporting the new objimpl finalization query.

Suggested reviewers: ShaharNaveh, youknowone

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding GC-related Python C-API bindings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bschoenmaeckers
Add garbage collection c-api
7e34cc2
@bschoenmaeckers
bschoenmaeckers force-pushed the c-api-gc branch from da76b6e to 7e34cc2 Compare July 8, 2026 10:04
ShaharNaveh
ShaharNaveh approved these changes Jul 8, 2026
View reviewed changes
youknowone
youknowone approved these changes Jul 9, 2026
View reviewed changes
@youknowone
youknowone merged commit 6b1bd40 into RustPython:main Jul 9, 2026
26 checks passed

Uh oh!

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

@bschoenmaeckers
bschoenmaeckers deleted the c-api-gc branch July 9, 2026 06:35
@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 pushed a commit that referenced this pull request Sep 16, 2026
@bschoenmaeckers
Add garbage collection c-api (#8239)
61d91d6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@youknowone youknowone youknowone approved these changes
@ShaharNaveh ShaharNaveh ShaharNaveh approved these changes

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.

3 participants

@bschoenmaeckers @youknowone @ShaharNaveh
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 01402503 — 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.