python / python/cpython

Py_DEPRECATED should account for Py_Limited_API

Aperta
#117,927 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

type-feature
Lingua principale
Python
Stelle
77.2k
Fork
35.9k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

Feature or enhancement

Proposal:

Take the example of Py_SetPythonHome().
It has been deprecated in 3.11, and we should now do things with PyConfig (added in 3.8).
But it is also part of the limited API. So it should not actually disappear, and someone building with Py_Limited_API<3.8 does not have the available symbols to use the non deprecated variant.
So every developer building with the limited API that cares about the warning will have to study each deprecated function, and if the non deprecated vairant is not in the stable API, add local deprecation warning disable code.

The proposal:
When Py_LimitedAPI is defined, Py_Deprecated should not trigger a warning if The deprecation version is greater than the limited API version selected by the macro (3.2 if the macro is empty, otherwise, the version value in Py_Limited_API), since we are really compiling for a lower version of python

I can probably do the PR myself if it is accepted

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia individuando le definizioni e gli utilizzi di Py_DEPRECATED e Py_Limited_API negli header di CPython, quindi segui la dichiarazione di Py_SetPythonHome come esempio concreto. Verifica in che modo la versione selezionata di limited-API influisce sugli avvisi di deprecazione e verifica che gli avvisi vengano soppressi solo quando il sostituto non è disponibile in quella versione dell'API.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
api
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.