[PyKDE] SIP 4.0pre3
Oliver Kohlbacher
oliver at bioinf.uni-sb.de
Sun Nov 2 12:54:00 GMT 2003
Dear Phil,
I finally had the time to look at SIP 4.0 and it really
looks great to me.
Nevertheless, I managed to track down a few tiny bugs you might
want to fix:
- in the exception code (OK, I'm to blame for that) there
might occur core dumps due to an incorrect format string
- The error message printed for operators SIP does not wrap
automatically still talks about "%MemberCode", whereas the new
version should rather require "%MethodCode"
- When wrapping operator () (i.e., __call__) SIP currently insists on
exactly one argument. This prevents the user from wrapping
something like Matrix::operator () (int row, int col). There
is a trivial fix with two lines of code attached.
- Is there a reason to have __neg__ and __cmp__ not wrapped
automatically? I tried it for my code (by replacing FALSE by TRUE
in the slot_table) and it seems to work fine.
Attached are the context diffs against 4.0pre3 resolving these issues.
Hope this helps,
Oliver
--
Oliver Kohlbacher (oliver.kohlbacher at uni-tuebingen.de)
Professor for Simulation of Biological Systems,
Wilhelm Schickard Institute for Computer Science, University of Tübingen
Room C317, Sand 14, 72076 Tübingen, Germany
phone: +49-7071-29-70457 fax: +49-7071-29-5152
-------------- next part --------------
*** sip-x11-gpl-4.0pre3/sipgen/gencode.c 2003-10-28 12:08:49.000000000 +0100
--- sip-x11-gpl-4.0pre3-patched/sipgen/gencode.c 2003-11-01 00:23:51.000000000 +0100
***************
*** 5572,5578 ****
if (a > 0)
prcode(fp,",");
! prcode(fp,"%S",ta -> args[a]);
}
prcode(fp,")");
--- 5572,5578 ----
if (a > 0)
prcode(fp,",");
! prcode(fp,"%P",ta -> args[a]);
}
prcode(fp,")");
***************
*** 6549,6555 ****
prcode(fp,"((*sipCpp) %s %sa0)",op,(deref ? "*" : ""));
}
-
/*
* Generate the argument variables for a member function/constructor.
*/
--- 6549,6554 ----
-------------- next part --------------
*** sip-x11-gpl-4.0pre3/sipgen/parser.y 2003-10-28 12:08:49.000000000 +0100
--- sip-x11-gpl-4.0pre3-patched/sipgen/parser.y 2003-11-01 00:33:14.000000000 +0100
***************
*** 2609,2615 ****
{"__ilshift__", ilshift_slot, FALSE, 1},
{"__irshift__", irshift_slot, FALSE, 1},
{"__invert__", invert_slot, FALSE, 0},
! {"__call__", call_slot, TRUE, 2},
{"__getitem__", getitem_slot, TRUE, 1},
{"__setitem__", setitem_slot, TRUE, 2},
{"__delitem__", delitem_slot, TRUE, 1},
--- 2609,2615 ----
{"__ilshift__", ilshift_slot, FALSE, 1},
{"__irshift__", irshift_slot, FALSE, 1},
{"__invert__", invert_slot, FALSE, 0},
! {"__call__", call_slot, TRUE, -1},
{"__getitem__", getitem_slot, TRUE, 1},
{"__setitem__", setitem_slot, TRUE, 2},
{"__delitem__", delitem_slot, TRUE, 1},
***************
*** 2619,2627 ****
{"__ne__", ne_slot, FALSE, 1},
{"__gt__", gt_slot, FALSE, 1},
{"__ge__", ge_slot, FALSE, 1},
! {"__cmp__", cmp_slot, TRUE, 1},
{"__nonzero__", nonzero_slot, TRUE, 0},
! {"__neg__", neg_slot, TRUE, 0},
{"__repr__", repr_slot, TRUE, 0},
{NULL}
};
--- 2619,2627 ----
{"__ne__", ne_slot, FALSE, 1},
{"__gt__", gt_slot, FALSE, 1},
{"__ge__", ge_slot, FALSE, 1},
! {"__cmp__", cmp_slot, FALSE, 1},
{"__nonzero__", nonzero_slot, TRUE, 0},
! {"__neg__", neg_slot, FALSE, 0},
{"__repr__", repr_slot, TRUE, 0},
{NULL}
};
***************
*** 2641,2649 ****
yyerror("Python slots must be class methods");
if (sm -> needs_hwcode && !hwcode)
! yyerror("This Python slot requires %MemberCode");
! if (sm -> nrargs != nrargs)
yyerror("Incorrect number of arguments to Python slot");
st = sm -> type;
--- 2641,2649 ----
yyerror("Python slots must be class methods");
if (sm -> needs_hwcode && !hwcode)
! yyerror("This Python slot requires %MethodCode");
! if ((sm -> nrargs != nrargs) && (sm -> nrargs != -1))
yyerror("Incorrect number of arguments to Python slot");
st = sm -> type;
More information about the PyQt
mailing list