python.cfg: Improve Python C API configuration (#2183)

Add configurations for functions reported by daca@home.
Remove redundantly configured functions.
Add/improve some other function configurations.
This commit is contained in:
Sebastian 2019-09-19 10:34:14 +02:00 committed by GitHub
parent 518bb5195c
commit 174badf242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 83 additions and 32 deletions

View File

@ -39,6 +39,8 @@
<define name="PyObject_FREE" value="PyObject_Free"/>
<define name="PyObject_Del" value="PyObject_Free"/>
<define name="PyObject_DEL" value="PyObject_Free"/>
<define name="PyObject_New(type, typeobj)" value="( (type *) _PyObject_New(typeobj) )"/>
<define name="PyObject_NewVar(type, typeobj, n)" value="( (type *) _PyObject_NewVar((typeobj), (n)) )"/>
<!-- ########## Python C API Allocation / Deallocation ########## -->
<memory>
<alloc init="false" buffer-size="malloc">PyMem_Malloc</alloc>
@ -60,6 +62,8 @@
</memory>
<!-- ########## Python C API Functions ########## -->
<!-- Those are macros, but it's helpful to declare a function here -->
<!-- void Py_INCREF(PyObject *o) -->
<!-- void Py_DECREF(PyObject *o) -->
<function name="Py_INCREF,Py_IncRef,Py_DECREF,Py_DecRef">
<leak-ignore/>
<noreturn>false</noreturn>
@ -70,6 +74,9 @@
</arg>
</function>
<!-- Those are macros, but it's helpful to declare a function here -->
<!-- void Py_XINCREF(PyObject *o) -->
<!-- void Py_XDECREF(PyObject *o) -->
<!-- void Py_CLEAR(PyObject *o) -->
<function name="Py_XINCREF,Py_XDECREF,Py_CLEAR">
<leak-ignore/>
<noreturn>false</noreturn>
@ -94,10 +101,13 @@
<not-uninit/>
</arg>
</function>
<!-- void Py_Initialize() -->
<!-- void Py_Finalize() -->
<function name="Py_Initialize,Py_Finalize">
<noreturn>false</noreturn>
<returnValue type="void"/>
</function>
<!-- void Py_InitializeEx(int initsigs) -->
<function name="Py_InitializeEx">
<noreturn>false</noreturn>
<returnValue type="void"/>
@ -106,12 +116,56 @@
<not-uninit/>
</arg>
</function>
<!-- PyObject* Py_InitModule(char *name, PyMethodDef *methods) -->
<function name="Py_InitModule">
<noreturn>false</noreturn>
<returnValue type="PyObject*"/>
<arg nr="1">
<not-uninit/>
</arg>
<arg nr="2">
<not-uninit/>
</arg>
</function>
<!-- PyObject* Py_InitModule3(char *name, PyMethodDef *methods, char *doc) -->
<function name="Py_InitModule3">
<noreturn>false</noreturn>
<returnValue type="PyObject*"/>
<arg nr="1">
<not-uninit/>
</arg>
<arg nr="2">
<not-uninit/>
</arg>
<arg nr="3">
<not-uninit/>
</arg>
</function>
<!-- PyObject* Py_InitModule4(char *name, PyMethodDef *methods, char *doc, PyObject *self, int apiver) -->
<function name="Py_InitModule4">
<noreturn>false</noreturn>
<returnValue type="PyObject*"/>
<arg nr="1">
<not-uninit/>
</arg>
<arg nr="2">
<not-uninit/>
</arg>
<arg nr="3">
<not-uninit/>
</arg>
<arg nr="4" direction="in">
<not-uninit/>
</arg>
</function>
<!-- int Py_IsInitialized() -->
<function name="Py_IsInitialized">
<noreturn>false</noreturn>
<pure/>
<returnValue type="int"/>
<use-retval/>
</function>
<!-- int Py_Main(int argc, wchar_t **argv) -->
<function name="Py_Main">
<leak-ignore/>
<returnValue type="int"/>
@ -123,6 +177,8 @@
<not-uninit/>
</arg>
</function>
<!-- void Py_SetProgramName(const wchar_t *name) -->
<!-- void Py_SetPythonHome(const wchar_t *home) -->
<function name="Py_SetProgramName,Py_SetPythonHome">
<leak-ignore/>
<noreturn>false</noreturn>
@ -156,6 +212,7 @@
<returnValue type="int"/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-null/>
<not-uninit/>
</arg>
<arg nr="2" direction="in">
@ -163,6 +220,7 @@
<strz/>
</arg>
<arg nr="3">
<not-uninit/>
<not-bool/>
</arg>
</function>
@ -361,35 +419,16 @@
</arg>
<arg nr="2"/>
</function>
<!-- https://docs.python.org/2.0/ext/parseTuple.html
int PyArg_ParseTuple(PyObject *arg, char *format, ...); -->
<function name="PyArg_ParseTuple">
<returnValue type="int"/>
<!-- PyObject* PyBytes_FromString(const char *v) -->
<function name="PyBytes_FromString">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
<returnValue type="PyObject*"/>
<use-retval/>
<arg nr="1" direction="in">
<not-null/>
<not-uninit/>
</arg>
<arg nr="2">
<not-uninit/>
<formatstr/>
</arg>
<arg nr="3"/>
</function>
<function name="PyArg_VaParse">
<returnValue type="int"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1">
<not-null/>
<not-uninit/>
</arg>
<arg nr="2">
<not-uninit/>
</arg>
<arg nr="3">
<not-uninit/>
<not-bool/>
<strz/>
</arg>
</function>
<!-- int PyInt_Check(PyObject *o) -->
@ -468,24 +507,36 @@
<not-uninit/>
</arg>
</function>
<!-- TYPE* PyObject_New(TYPE, PyTypeObject *type) -->
<function name="PyObject_New">
<!-- PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *); -->
<function name="_PyObject_New">
<noreturn>false</noreturn>
<returnValue type="PyObject *"/>
<use-retval/>
<arg nr="1"/>
<arg nr="2"/>
</function>
<!-- TYPE* PyObject_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size) -->
<function name="PyObject_NewVar">
<!-- PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t); -->
<function name="_PyObject_NewVar">
<noreturn>false</noreturn>
<returnValue type="PyVarObject *"/>
<use-retval/>
<arg nr="1"/>
<arg nr="2"/>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- PyObject* PyString_FromString(const char *v) -->
<function name="PyString_FromString">
<noreturn>false</noreturn>
<returnValue type="PyObject*"/>
<use-retval/>
<arg nr="1" direction="in">
<not-null/>
<not-uninit/>
<not-bool/>
<strz/>
</arg>
</function>
<!-- Deprecated DL_IMPORT and DL_EXPORT macros -->
<define name="DL_IMPORT(RTYPE)" value="RTYPE"/>
<define name="DL_EXPORT(RTYPE)" value="RTYPE"/>