[pypy-svn] r5311 - pypy/trunk/src/pypy/interpreter
arigo at codespeak.net
arigo at codespeak.net
Fri Jun 25 18:30:13 CEST 2004
Author: arigo
Date: Fri Jun 25 18:30:12 2004
New Revision: 5311
Modified:
pypy/trunk/src/pypy/interpreter/argument.py
Log:
Tentative solution to the problem of r5309:
The name of extra bound arguments are ignored by the keywords checking code.
Modified: pypy/trunk/src/pypy/interpreter/argument.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/argument.py (original)
+++ pypy/trunk/src/pypy/interpreter/argument.py Fri Jun 25 18:30:12 2004
@@ -14,6 +14,8 @@
### Construction ###
+ blind_arguments = 0
+
def __init__(self, space, args_w=[], kwds_w={}):
assert isinstance(args_w, list) # I keep forgetting the 'space'
assert isinstance(kwds_w, dict) # argument so hopefully this helps
@@ -50,7 +52,9 @@
def prepend(self, w_firstarg):
"Return a new Arguments with a new argument inserted first."
- return Arguments(self.space, [w_firstarg] + self.args_w, self.kwds_w)
+ args = Arguments(self.space, [w_firstarg] + self.args_w, self.kwds_w)
+ args.blind_arguments = self.blind_arguments + 1
+ return args
def join(self, other):
"Return a new Arguments combining the content of two Arguments."
@@ -99,8 +103,11 @@
input_argcount = len(scope_w)
# check that no keyword argument conflicts with these
+ # note that for this purpose we ignore the first blind_arguments,
+ # which were put into place by prepend(). This way, keywords do
+ # not conflict with the hidden extra argument bound by methods.
if kwds_w:
- for name in argnames[:input_argcount]:
+ for name in argnames[self.blind_arguments:input_argcount]:
if name in kwds_w:
self.raise_argerr_multiple_values(fnname, name)
More information about the Pypy-commit
mailing list