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