[EMAIL PROTECTED] wrote:
> 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

Hi Christian,

could you please write a couple of tests for this? It's very hard to see 
what this code is doing and whether it is broken without tests for its 
functionality.

Cheers,

Carl Friedrich
_______________________________________________
[email protected]
http://codespeak.net/mailman/listinfo/pypy-dev

Reply via email to