Export real functions for things that currently exist as macros / defines / global variables in the C code

Aperta
#98,574 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
20/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
c, python
Ambito
api

Direzione di ricerca

Non vengono nominati file, test o voci API specifiche. Inizia esaminando la C DLL API per individuare le macro, i define e le variabili globali menzionati; definisci un insieme limitato di alternative di funzione e verifica che gli elementi selezionati siano esportati e utilizzabili da un wrapper di livello superiore.

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

Descrizione

interpreter-core type-feature

Feature or enhancement

(A clear and concise description of your proposal.)

Pitch

I am writing a python wrapper in a higher level language using the C DLL API. Within certain higher level languages, it is not easily possible to access anything other than the exported functions from the DLL. Macros / defines / global variables are troublesome to interact with from the DLL.

So, If I only have easy access to the function API in my higher level language, type checking sort of becomes an issue due to things like PyList_Check being a macro and PyList_Type being a global variable. Exposing global variables (such as PyList_Type) through function APIs that just return a pointer to the data (for example) prevents a structure re layout from leaking out of the DLL... not to mention gives easier access to the data I need to call a type check function.

For things like PyList_Check that are macros, but are still useful for direct checks, they could be converted to a function API.

(Explain why this feature or enhancement should be implemented and how it would be used.
Add examples, if applicable.)

I do not suggest converting macros / defines cold turkey into a function API... obviously, that could break a lot of code for users of the C library. Instead, provide function alternatives to the items as a parallel API for those of us that can only really call DLL functions in our higher level language. As I go through some of the C API, I do notice areas where a macro and a function form of an API do exist in parallel. It would be nice if we could continue to extend that, especially for type checks.

Previous discussion

Apologies if this is discussed elsewhere. Move or edit as needed.

Lingua principale
Python
Stelle
77.2k
Fork
36k
Merge medio
1g 9h
PR unite (30g)
558

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.

Altre issue di python/cpython

Tutte le issue di python/cpython

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.