Message984
Logged In: YES
user_id=18288
The error checking appears to be implemented in
ArgParser.check(). It currently checks for valid keyword
params and for params given as both keyword and positional
args. So this is probably the place to implement a duplicate
keyword check.
I don't see an attach file button in this tracker item, so
at the risk of having this mangled by putting it in the
comment body, the following adds the necessary checking and
fixes the test case described in the tracker summary.
- kz
Index: ArgParser.java
===================================================================
RCS file:
/cvsroot/jython/jython/org/python/core/ArgParser.java,v
retrieving revision 1.10
diff -u -r1.10 ArgParser.java
--- ArgParser.java 10 Oct 2005 19:34:46 -0000 1.10
+++ ArgParser.java 17 Nov 2005 03:44:10 -0000
@@ -199,6 +199,12 @@
private void check() {
int nargs = this.args.length - this.kws.length;
l1: for (int i = 0; i < this.kws.length; i++) {
+ for (int k = i+1; k < this.kws.length; k++) {
+ if (this.kws[i].equals(this.kws[k])) {
+ throw Py.SyntaxError("duplicate keyword
argument '"
+ + this.kws[i] + "'");
+ }
+ }
for (int j = 0; j < this.params.length; j++) {
if (this.kws[i].equals(this.params[j])) {
if (j < nargs) {
|
|
Date |
User |
Action |
Args |
2008-02-20 17:17:22 | admin | link | issue1222877 messages |
2008-02-20 17:17:22 | admin | create | |
|