python / python/cpython

Promote `PyUnstable_Object_GC_NewWithExtraData()` to the stable API

Offen
#148,498 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

interpreter-core topic-C-API type-feature
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
35.9k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

Feature or enhancement

Proposal:

Allocating variable sized Python objects via the C API is a genuinely useful operation. It is e.g. needed to

  • implement custom data structures (tuples, lists)
  • implement binding libraries (like nanobind) that co-locate binding data structures with Python objects

So far, the standard way to create them was via PyVarObject, and this was supported even in stable ABI builds. Unfortunately, this data structure becomes inaccessible with the upcoming free-threaded flavor of the stable ABI.

I would like to propose that the function PyUnstable_Object_GC_NewWithExtraData() be promoted to the stable API to provide an escape hatch for extensions that require variable sized objects in abi3t. This will enable extensions to implement variable sized objects without depending on the specifics of PyVarObject.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs
  • gh-148499

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem Lesen der C-API-Dokumentation für PyUnstable_Object_GC_NewWithExtraData() und der Diskussion des Issues über PyVarObject, free-threaded Builds und die stabile ABI. Die Arbeit ist abgeschlossen, wenn diese Funktion in die stabile API aufgenommen wurde und Erweiterungen sie für Objekte variabler Größe in abi3t verwenden können.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
c, python
Bereich
api
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.