[Python] Improve handling of SWIG_Py*Method_New
The SWIG_PyInstanceMethod_New method is no longer added to wrapped classes except when it's actually needed, which is when (!builtin && fastproxy) is true (which it isn't by default). The SWIG_PyStaticMethod_New method is no longer is now similarly gated - previously only (fastproxy) was checked. Finally the C/C++ functions that implement these were always compiled into the module, but now they're only included if (!builtin && fastproxy) is true. Issue noted by vadz in #2190.
This commit is contained in:
parent
07f3637f06
commit
951f946341
2 changed files with 24 additions and 8 deletions
|
|
@ -8,6 +8,8 @@
|
|||
%fragment("<stddef.h>"); // For offsetof
|
||||
#endif
|
||||
|
||||
#if defined SWIGPYTHON_FASTPROXY && !defined SWIGPYTHON_BUILTIN
|
||||
|
||||
%insert(runtime) %{
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -24,6 +26,8 @@ SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyO
|
|||
#endif
|
||||
%}
|
||||
|
||||
#endif
|
||||
|
||||
%init %{
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -103,6 +107,8 @@ SWIG_Python_FixMethods(PyMethodDef *methods, const swig_const_info *const_table,
|
|||
}
|
||||
}
|
||||
|
||||
#if defined SWIGPYTHON_FASTPROXY && !defined SWIGPYTHON_BUILTIN
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Method creation and docstring support functions
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
@ -161,6 +167,8 @@ SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyO
|
|||
return PyStaticMethod_New(func);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue