Re-implement Python -fastproxy option.

The previous implementation failed with Python 3 and abstract base clases.
The new implementation replaces the Python 2 implementation using new.instancemethod with C API PyMethod_New to match the equivalent Python 3 implementation which uses PyInstanceMethod_New.

Closes #1310
This commit is contained in:
William S Fulton 2018-08-17 23:34:29 +01:00
commit c9cac931c7
6 changed files with 144 additions and 32 deletions

View file

@ -29,17 +29,14 @@ typedef struct swig_const_info {
* Wrapper of PyInstanceMethod_New() used in Python 3
* It is exported to the generated module, used for -fastproxy
* ----------------------------------------------------------------------------- */
#if PY_VERSION_HEX >= 0x03000000
SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func)
{
#if PY_VERSION_HEX >= 0x03000000
return PyInstanceMethod_New(func);
}
#else
SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func))
{
return NULL;
}
return PyMethod_New(func, NULL, NULL);
#endif
}
#ifdef __cplusplus
}