Skip to content

Cross Language Garbage Collection PR - #2

Open
Thrameos wants to merge 1 commit into
mainfrom
clgc2
Open

Thrameos wants to merge 1 commit into
mainfrom
clgc2

Conversation

@Thrameos

@Thrameos Thrameos commented Jun 9, 2025

Copy link
Copy Markdown
Owner

Opaque Garbage Collection Reference Manager API

Summary:
This PR implements a new, fully opaque API for external reference managers to participate in CPython’s garbage collection process, as described in PEP XXXX.

Motivation:

  • Enables safe, cross-runtime GC (JPype, Pyodide, pythonnet, etc.)
  • Provides a forward-compatible, contract-based extension point
  • Does not expose or depend on GC internals

Key Features:

  • Opaque, phase-based API (no GC internals exposed)
  • Strict contract for extension authors
  • Additive and opt-in: no impact if unused
  • Fully documented and tested

Files Changed:

  • Include/cpython/clgc.h: New public API
  • Python/gc.c: Implementation and integration

Request for Review:

  • API contract and extensibility
  • Thread safety and error handling
  • Suitability for known use cases (JPype, Pyodide)

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.

1 participant