Re-organise some generate Python code for method creation and docstring support
Fix ‘PyMethodDef* SWIG_PythonGetProxyDoc(const char*)’ declared ‘static’ but never defined [-Wunused-function] Closes #1448
This commit is contained in:
parent
a0720885bd
commit
43438b66ab
4 changed files with 64 additions and 55 deletions
|
|
@ -24,44 +24,6 @@ typedef struct swig_const_info {
|
|||
swig_type_info **ptype;
|
||||
} swig_const_info;
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Function to find the method definition with the correct docstring for the
|
||||
* proxy module as opposed to the low-level API
|
||||
* ----------------------------------------------------------------------------- */
|
||||
SWIGRUNTIME PyMethodDef *SWIG_PythonGetProxyDoc(const char *name);
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Wrapper of PyInstanceMethod_New() used in Python 3
|
||||
* It is exported to the generated module, used for -fastproxy
|
||||
* ----------------------------------------------------------------------------- */
|
||||
SWIGRUNTIME PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) {
|
||||
if (PyCFunction_Check(func)) {
|
||||
PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
|
||||
PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name);
|
||||
if (ml)
|
||||
func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
|
||||
}
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
return PyInstanceMethod_New(func);
|
||||
#else
|
||||
return PyMethod_New(func, NULL, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Wrapper of PyStaticMethod_New()
|
||||
* It is exported to the generated module, used for -fastproxy
|
||||
* ----------------------------------------------------------------------------- */
|
||||
SWIGRUNTIME PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) {
|
||||
if (PyCFunction_Check(func)) {
|
||||
PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
|
||||
PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name);
|
||||
if (ml)
|
||||
func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
|
||||
}
|
||||
return PyStaticMethod_New(func);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue