This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2021-09-29.08:18:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1632903484.87.0.875373224779.issue45316@roundup.psfhosted.org>
In-reply-to
Content
The Python C API contains multiple functions which are not exported with PyAPI_FUNC() and so are not usable.

Public functions:
---
void PyLineTable_InitAddressRange(const char *linetable, Py_ssize_t length, int firstlineno, PyCodeAddressRange *range);
int PyLineTable_NextAddressRange(PyCodeAddressRange *range);
int PyLineTable_PreviousAddressRange(PyCodeAddressRange *range);
---

=> Either make this functions private ("_Py" prefix) and move them to the internal C API, or add PyAPI_FUNC().


Private functions:
---
int _PyCode_InitAddressRange(PyCodeObject* co, PyCodeAddressRange *bounds);
int _PyCode_InitEndAddressRange(PyCodeObject* co, PyCodeAddressRange* bounds);

PyDictKeysObject *_PyDict_NewKeysForClass(void);
Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys);
uint32_t _PyDictKeys_GetVersionForCurrentState(PyDictKeysObject *dictkeys);
Py_ssize_t _PyDictKeys_StringLookup(PyDictKeysObject* dictkeys, PyObject *key);

PyObject *_PyDict_Pop_KnownHash(PyObject *, PyObject *, Py_hash_t, PyObject *);
PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *);
int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value);
PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *);
Py_ssize_t _PyDict_GetItemHint(PyDictObject *, PyObject *, Py_ssize_t, PyObject **);

PyFrameObject* _PyFrame_New_NoTrack(struct _interpreter_frame *, int);
int PySignal_SetWakeupFd(int fd);
uint32_t _PyFunction_GetVersionForCurrentState(PyFunctionObject *func);
PyObject *_PyGen_yf(PyGenObject *);
PyObject *_PyCoro_GetAwaitableIter(PyObject *o);
PyObject *_PyAsyncGenValueWrapperNew(PyObject *);
void _PyArg_Fini(void);
int _Py_CheckPython3(void);
---

=> I suggest to move all these declarations to the internal C API.


Moreover, Include/moduleobject.h contains:
---
#ifdef Py_BUILD_CORE
extern int _PyModule_IsExtension(PyObject *obj);
#endif
---

IMO this declaration should be moved to the internal C API.


See also bpo-45201 about PySignal_SetWakeupFd().
History
Date User Action Args
2021-09-29 08:18:06vstinnersetrecipients: + vstinner
2021-09-29 08:18:04vstinnersetmessageid: <1632903484.87.0.875373224779.issue45316@roundup.psfhosted.org>
2021-09-29 08:18:04vstinnerlinkissue45316 messages
2021-09-29 08:18:04vstinnercreate