[pypy-svn] r68435 - pypy/trunk/pypy/interpreter
cfbolz at codespeak.net
cfbolz at codespeak.net
Wed Oct 14 14:55:31 CEST 2009
Author: cfbolz
Date: Wed Oct 14 14:55:30 2009
New Revision: 68435
Added:
pypy/trunk/pypy/interpreter/function.py.merge.tmp
- copied, changed from r68434, pypy/trunk/pypy/interpreter/function.py
Log:
merging of svn+ssh://codespeak.net/svn/pypy/branch/improve-kwd-args/pypy/interpreter/function.py
revisions 68277 to 68434:
------------------------------------------------------------------------
r68395 | cfbolz | 2009-10-13 20:42:42 +0200 (Tue, 13 Oct 2009) | 2 lines
make defs_w attribute of Function objects non-resizable
------------------------------------------------------------------------
r68278 | pedronis | 2009-10-09 16:43:11 +0200 (Fri, 09 Oct 2009) | 2 lines
(cfbolz, pedronis): a branch where we want to refactor the Arguments class for fun and profit.
------------------------------------------------------------------------
Copied: pypy/trunk/pypy/interpreter/function.py.merge.tmp (from r68434, pypy/trunk/pypy/interpreter/function.py)
==============================================================================
--- pypy/trunk/pypy/interpreter/function.py (original)
+++ pypy/trunk/pypy/interpreter/function.py.merge.tmp Wed Oct 14 14:55:30 2009
@@ -12,6 +12,7 @@
from pypy.interpreter.eval import Code
from pypy.interpreter.argument import Arguments
from pypy.rlib.jit import hint
+from pypy.rlib.debug import make_sure_not_resized
funccallunrolling = unrolling_iterable(range(4))
@@ -28,6 +29,7 @@
self.w_func_globals = w_globals # the globals dictionary
self.closure = closure # normally, list of Cell instances or None
self.defs_w = defs_w # list of w_default's
+ make_sure_not_resized(self.defs_w)
self.w_func_dict = None # filled out below if needed
self.w_module = None
@@ -182,7 +184,7 @@
else:
name = None
if not space.is_w(w_argdefs, space.w_None):
- defs_w = space.unpackiterable(w_argdefs)
+ defs_w = space.viewiterable(w_argdefs)
else:
defs_w = []
nfreevars = 0
@@ -270,7 +272,7 @@
w(self.code),
w_func_globals,
w_closure,
- nt(self.defs_w[:]),
+ nt(self.defs_w),
w_func_dict,
self.w_module,
]
@@ -300,22 +302,22 @@
if space.is_w(w_func_dict, space.w_None):
w_func_dict = None
self.w_func_dict = w_func_dict
- self.defs_w = space.unpackiterable(w_defs_w)
+ self.defs_w = space.viewiterable(w_defs_w)
self.w_module = w_module
def fget_func_defaults(space, self):
values_w = self.defs_w
if not values_w:
return space.w_None
- return space.newtuple(values_w[:])
+ return space.newtuple(values_w)
def fset_func_defaults(space, self, w_defaults):
if space.is_w(w_defaults, space.w_None):
self.defs_w = []
return
- if not space.is_true( space.isinstance( w_defaults, space.w_tuple ) ):
+ if not space.is_true(space.isinstance(w_defaults, space.w_tuple)):
raise OperationError( space.w_TypeError, space.wrap("func_defaults must be set to a tuple object or None") )
- self.defs_w = space.unpackiterable( w_defaults )
+ self.defs_w = space.viewiterable(w_defaults)
def fdel_func_defaults(space, self):
self.defs_w = []
More information about the Pypy-commit
mailing list