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

Ouverte
#98,574 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
20/100
Type d'issue
Fonctionnalité
Clarté
À clarifier
Activité
À l'abandon
Stack technique
c, python
Domaine
api

Piste de recherche

Aucun fichier, test ou entrée d'API spécifique n'est nommé. Commencez par examiner la C DLL API pour trouver les macros, defines et variables globales mentionnés ; définissez un ensemble limité d'alternatives de fonctions et vérifiez que les éléments sélectionnés sont exportés et utilisables depuis un wrapper de niveau supérieur.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Python
Étoiles
77.2k
Forks
36k
Merge moyen
1 j 9 h
PR mergées (30 j)
558

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de python/cpython

Toutes les issues de python/cpython

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.