[pypy-svn] r48350 - pypy/dist/pypy/objspace/flow
tismer at codespeak.net
tismer at codespeak.net
Wed Nov 7 05:18:58 CET 2007
Author: tismer
Date: Wed Nov 7 05:18:57 2007
New Revision: 48350
Modified:
pypy/dist/pypy/objspace/flow/specialcase.py
Log:
some over-due relaxing to __import__ annotation
Modified: pypy/dist/pypy/objspace/flow/specialcase.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/specialcase.py (original)
+++ pypy/dist/pypy/objspace/flow/specialcase.py Wed Nov 7 05:18:57 2007
@@ -6,7 +6,18 @@
from pypy.tool.cache import Cache
def sc_import(space, fn, args):
- w_name, w_glob, w_loc, w_frm = args.fixedunpack(4)
+ args_w, kwds_w = args.unpack()
+ assert kwds_w == {}, "should not call %r with keyword arguments" % (fn,)
+ assert len(args_w) > 0 and len(args_w) <= 4, 'import needs 1 to 4 arguments'
+ w_name = args_w[0]
+ w_None = space.wrap(None)
+ w_glob, w_loc, w_frm = w_None, w_None, w_None
+ if len(args_w) > 1:
+ w_glob = args_w[1]
+ if len(args_w) > 2:
+ w_loc = args_w[2]
+ if len(args_w) > 3:
+ w_frm = args_w[3]
if not isinstance(w_loc, Constant):
# import * in a function gives us the locals as Variable
# we always forbid it as a SyntaxError
More information about the pypy-svn
mailing list