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

@ -2129,7 +2129,7 @@ public:
int noargs = funpack && (tuple_required == 0 && tuple_arguments == 0);
int onearg = funpack && (tuple_required == 1 && tuple_arguments == 1);
if (builtin && funpack && !overname && !builtin_ctor) {
if (builtin && funpack && !overname && !builtin_ctor && !GetFlag(n, "feature:compactdefaultargs")) {
String *argattr = NewStringf("%d", tuple_arguments);
Setattr(n, "python:argcount", argattr);
Delete(argattr);
@ -3434,7 +3434,9 @@ public:
printSlot(f, getSlot(n, "feature:python:nb_true_divide"), "nb_true_divide", "binaryfunc");
printSlot(f, getSlot(n, "feature:python:nb_inplace_floor_divide"), "nb_inplace_floor_divide", "binaryfunc");
printSlot(f, getSlot(n, "feature:python:nb_inplace_true_divide"), "nb_inplace_true_divide", "binaryfunc");
Printv(f, "#if PY_VERSION_HEX >= 0x02050000\n", NIL);
printSlot(f, getSlot(n, "feature:python:nb_index"), "nb_index", "unaryfunc");
Printv(f, "#endif\n", NIL);
Printf(f, " },\n");
// PyMappingMethods as_mapping;