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:
Stefan Zager 2011-04-02 21:40:00 +00:00
commit 90fe22acf7
6 changed files with 63 additions and 7 deletions

View file

@ -129,8 +129,8 @@ SwigPython_std_pair_repr (PyObject *o)
{
PyObject *tuple = PyTuple_New(2);
assert(tuple);
PyTuple_SET_ITEM(tuple, 0, PyObject_GetAttrString(o, "first"));
PyTuple_SET_ITEM(tuple, 1, PyObject_GetAttrString(o, "second"));
PyTuple_SET_ITEM(tuple, 0, PyObject_GetAttrString(o, (char*) "first"));
PyTuple_SET_ITEM(tuple, 1, PyObject_GetAttrString(o, (char*) "second"));
PyObject *result = PyObject_Repr(tuple);
Py_DECREF(tuple);
return result;
@ -139,14 +139,14 @@ SwigPython_std_pair_repr (PyObject *o)
SWIGINTERN PyObject*
SwigPython_std_pair_getitem (PyObject *a, Py_ssize_t b)
{
PyObject *result = PyObject_GetAttrString(a, b % 2 ? "second" : "first");
PyObject *result = PyObject_GetAttrString(a, b % 2 ? (char*) "second" : (char*) "first");
return result;
}
SWIGINTERN int
SwigPython_std_pair_setitem (PyObject *a, Py_ssize_t b, PyObject *c)
{
int result = PyObject_SetAttrString(a, b % 2 ? "second" : "first", c);
int result = PyObject_SetAttrString(a, b % 2 ? (char*) "second" : (char*) "first", c);
return result;
}
#endif