C API: Enable limited C API tests on Free Threading
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Currently, the _testlimitedcapi extension module is not built with the limited C API on Free Threading which is misleading and defeats the purpose of this extension.
PEP 803 added Py_TARGET_ABI3T macro to Python 3.15 which makes it possible to build a C extension using the limited C API when using Free Threading. So I propose building _testlimitedcapi using Py_TARGET_ABI3T to test properly the limited C API on Free Threading.
One limitation is that Py_TARGET_ABI3T minimum version is Python 3.15, whereas _testlimitedcapi/<file>.c files target older Python versions. Anyway, we have to only define Py_TARGET_ABI3T on Free Threading, or define Py_LIMITED_API macro otherwise (build with GIL). Example:
#include "pyconfig.h" // Py_GIL_DISABLED
#ifdef Py_GIL_DISABLED
# define Py_TARGET_ABI3T 0x030f0000
#else
// Need limited C API version 3.13 for Py_GetConstant()
# define Py_LIMITED_API 0x030d0000
#endif
Linked PRs
- gh-155570
- gh-155693
- gh-156052
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con i sorgenti _testlimitedcapi/.c e le macro di pyconfig.h descritte nell’issue, quindi esamina come viene compilato _testlimitedcapi per Free Threading. Controlla i test della limited C API nell’estensione _testlimitedcapi e conferma che vengano compilati ed eseguiti con Py_TARGET_ABI3T su Free Threading, mantenendo Py_LIMITED_API per le build con GIL.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- c, python
- Ambito
- testing-qa
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100