Merge branch 'ahnolds-autodoc'

* ahnolds-autodoc:
  Apparently nicely lining things up violates pep8, so don't try
  Don't use bool in the generated files for C compatability
  Properly handle destructors as methods for autodoc and fix some stray newlines
  Fixing a bug where the cached doxygen docstring could be deleted while still in use, causing swig to segfault
  Fixing docstrings for variables and static functions for consistency
  Fixes so that fastproxy and autodoc work correctly with both low-level C API and high-level Python Shadow API
  Updating the changelog
  Also check documentation on the low-level API
  Fix a bug where anonymous arguments were misnumbered when used in constructors
  Fixing python docstring handling for -fastproxy

Conflicts:
	CHANGES.current
This commit is contained in:
William S Fulton 2019-02-02 21:39:48 +00:00
commit 1e2190e6b8
6 changed files with 409 additions and 121 deletions

View file

@ -24,6 +24,11 @@ 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
* ----------------------------------------------------------------------------- */
PyMethodDef* getProxyDoc(const char* name);
/* -----------------------------------------------------------------------------
* Wrapper of PyInstanceMethod_New() used in Python 3
@ -31,6 +36,17 @@ typedef struct swig_const_info {
* ----------------------------------------------------------------------------- */
SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func)
{
if (PyCFunction_Check(func)) {
/* Unpack the existing PyCFunction */
PyMethodDef* ml = ((PyCFunctionObject*) func)->m_ml;
PyObject* self = ((PyCFunctionObject*) func)->m_self;
PyObject* module = ((PyCFunctionObject*) func)->m_module;
/* Use the copy with the modified docstring if available */
ml = getProxyDoc(ml->ml_name);
if (ml != NULL) {
func = PyCFunction_NewEx(ml, self, module);
}
}
#if PY_VERSION_HEX >= 0x03000000
return PyInstanceMethod_New(func);
#else
@ -38,6 +54,26 @@ SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self),
#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)) {
/* Unpack the existing PyCFunction */
PyMethodDef* ml = ((PyCFunctionObject*) func)->m_ml;
PyObject* self = ((PyCFunctionObject*) func)->m_self;
PyObject* module = ((PyCFunctionObject*) func)->m_module;
/* Use the copy with the modified docstring if available */
ml = getProxyDoc(ml->ml_name);
if (ml != NULL) {
func = PyCFunction_NewEx(ml, self, module);
}
}
return PyStaticMethod_New(func);
}
#ifdef __cplusplus
}
#endif