Issue1222877
Created on 2005-06-17.19:45:48 by johahn, last changed 2009-03-03.15:55:15 by fwierzbicki.
msg983 (view) |
Author: Johan M. Hahn (johahn) |
Date: 2005-06-17.19:45:48 |
|
Python 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit
(Intel)] on win32
>>> complex(imag=3, imag=4)
SyntaxError: duplicate keyword argument
Jython 2.2a2 on java1.4.2_06 (JIT: null)
>>> complex(imag=4, imag=3)
4j
|
msg984 (view) |
Author: Khalid Zuberi (kzuberi) |
Date: 2005-11-17.23:29:07 |
|
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) {
|
msg4172 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2009-03-03.15:55:14 |
|
Fixed in 2.5 r6064. IMO not severe enough to fix in 2.2.
|
|
Date |
User |
Action |
Args |
2009-03-03 15:55:15 | fwierzbicki | set | status: open -> closed nosy:
+ fwierzbicki resolution: fixed messages:
+ msg4172 |
2005-06-17 19:45:48 | johahn | create | |
|