Fix for METH_O and -compactdefaultargs, in two parts:
- Don't mark a method as METH_O if it has compactdefaultargs - In SWIG_Python_UnpackTuple, allow for a non-tuple 'args'. Added compatibility for python versions 2.3 and 2.4. These are only partially supported; inheriting from wrapped types looks problematic. Versions older that 2.3 are unlikely ever to work. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12590 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
48faf20934
commit
90fe22acf7
6 changed files with 63 additions and 7 deletions
|
|
@ -153,4 +153,49 @@ PyObject *PyBool_FromLong(long ok)
|
|||
typedef int Py_ssize_t;
|
||||
# define PY_SSIZE_T_MAX INT_MAX
|
||||
# define PY_SSIZE_T_MIN INT_MIN
|
||||
typedef inquiry lenfunc;
|
||||
typedef intargfunc ssizeargfunc;
|
||||
typedef intintargfunc ssizessizeargfunc;
|
||||
typedef intobjargproc ssizeobjargproc;
|
||||
typedef intintobjargproc ssizessizeobjargproc;
|
||||
typedef getreadbufferproc readbufferproc;
|
||||
typedef getwritebufferproc writebufferproc;
|
||||
typedef getsegcountproc segcountproc;
|
||||
typedef getcharbufferproc charbufferproc;
|
||||
static inline long PyNumber_AsSsize_t (PyObject *x, void*)
|
||||
{
|
||||
long result = 0;
|
||||
PyObject *i = PyNumber_Int(x);
|
||||
if (i) {
|
||||
result = PyInt_AsLong(i);
|
||||
Py_DECREF(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if PY_VERSION_HEX < 0x02040000
|
||||
#define Py_VISIT(op) \
|
||||
do { \
|
||||
if (op) { \
|
||||
int vret = visit((op), arg); \
|
||||
if (vret) \
|
||||
return vret; \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#if PY_VERSION_HEX < 0x02030000
|
||||
typedef struct {
|
||||
PyTypeObject type;
|
||||
PyNumberMethods as_number;
|
||||
PyMappingMethods as_mapping;
|
||||
PySequenceMethods as_sequence;
|
||||
PyBufferProcs as_buffer;
|
||||
PyObject *name, *slots;
|
||||
} PyHeapTypeObject;
|
||||
#endif
|
||||
|
||||
#if PY_VERSION_HEX < 0x02030000
|
||||
typedef destructor freefunc;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue