[pypy-svn] r18582 - pypy/dist/pypy/interpreter
arigo at codespeak.net
arigo at codespeak.net
Fri Oct 14 18:59:37 CEST 2005
Author: arigo
Date: Fri Oct 14 18:59:36 2005
New Revision: 18582
Modified:
pypy/dist/pypy/interpreter/argument.py
Log:
avoid using a slice 'lst[n:]' in RPython if n>len(lst).
Modified: pypy/dist/pypy/interpreter/argument.py
==============================================================================
--- pypy/dist/pypy/interpreter/argument.py (original)
+++ pypy/dist/pypy/interpreter/argument.py Fri Oct 14 18:59:36 2005
@@ -207,7 +207,11 @@
# collect extra positional arguments into the *vararg
if varargname is not None:
if self.w_stararg is None: # common case
- scope_w.append(self.space.newtuple(args_w[co_argcount:]))
+ if len(args_w) > co_argcount: # check required by rpython
+ starargs_w = args_w[co_argcount:]
+ else:
+ starargs_w = []
+ scope_w.append(self.space.newtuple(starargs_w))
else: # shortcut for the non-unpack() case above
scope_w.append(self.w_stararg)
elif len(args_w) > co_argcount:
More information about the Pypy-commit
mailing list