³ò
Ñ‘RMc           @   sV   d  Z  d d k l Z d d k l Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d S(	   sW   
This module defines the abstract base classes that support execution:
Code and Frame.
iÿÿÿÿ(   t   OperationError(   t	   Wrappablet   Codec           B   sz   e  Z d  Z e Z e Z d Z d Z d Z	 e	 Z
 d „  Z d „  Z d „  Z d „  Z d „  Z d	 „  Z d
 „  Z d „  Z RS(   sJ   A code is a compiled version of some source code.
    Abstract base class.i   i   i   c         C   s   | |  _  d  S(   N(   t   co_name(   t   selfR   (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyt   __init__   s    c         C   s,   | i  |  | d ƒ } | i | ƒ | i ƒ  S(   s    Implements the 'exec' statement.N(   t   createframet   Nonet   setdictscopet   run(   R   t   spacet	   w_globalst   w_localst   frame(    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyt	   exec_code   s    c         C   s
   t  ‚ d  S(   N(   t   NotImplementedError(   R   (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyt	   signature#   s    c         C   s   |  i  ƒ  i ƒ  S(   sZ   List of names including the arguments, vararg and kwarg,
        and possibly more locals.(   R   t   getallvarnames(   R   (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyt   getvarnames&   s    c         C   s   |  i  ƒ  i ƒ  S(   N(   R   t   scope_length(   R   (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyt   getformalargcount+   s    c         C   s   | i  S(   N(   t   w_None(   R   R
   (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyt   getdocstring.   s    c         C   s   t  d ƒ ‚ d  S(   Ns   purely abstract(   R   (   R   t   funct   args(    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyt   funcrun1   s    c         C   s   |  i  | | i | ƒ ƒ S(   N(   R   t   prepend(   R   R   t   w_objR   (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyt   funcrun_obj4   s    (   t   __name__t
   __module__t   __doc__t   Truet   _immutable_t   Falset   hidden_applevelt
   FLATPYCALLt   PASSTHROUGHARGS1t   HOPELESSt   fast_natural_arityR   R   R   R   R   R   R   R   (    (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyR   	   s   							t   Framec           B   sw   e  Z d  Z d d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z RS(   s]   A frame is an environment supporting the execution of a code object.
    Abstract base class.iÿÿÿÿc         C   sQ   | |  _  | |  _ d  |  _ | d j  o t |  i ƒ  i ƒ  ƒ } n | |  _ d  S(   Ni    (   R
   R   R   R   t   lent   getcodeR   t	   numlocals(   R   R
   R   R+   (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyR   ;   s    			c         C   s   t  d ‚ d S(   s+   Abstract method to override. Runs the framet   abstractN(   t	   TypeError(   R   (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyR	   C   s    c         C   s   |  i  ƒ  |  i S(   s   Get the locals as a dictionary.(   t   fast2localsR   (   R   (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyt   getdictscopeG   s    
c         C   s   d  S(   N(   R   (   R   (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyR*   L   s    c         C   s   |  i  | i ƒ  ƒ S(   N(   t   wrapR*   (   R
   R   (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyt	   fget_codeO   s    c         C   s
   | i  ƒ  S(   N(   R/   (   R
   R   (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyt   fget_getdictscopeR   s    c         C   s   | |  _  |  i ƒ  d S(   s(   Initialize the locals from a dictionary.N(   R   t   locals2fast(   R   R   (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyR   U   s    	c         C   s   t  d ‚ d S(   s(   Abstract. Get the fast locals as a list.R,   N(   R-   (   R   (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyt   getfastscopeZ   s    c         C   s   t  d ‚ d S(   s   Abstract. Initialize the fast locals from a list of values,
        where the order is according to self.getcode().signature().R,   N(   R-   (   R   t   scope_w(    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyt   setfastscope^   s    c         C   sÄ   |  i  d  j o |  i i ƒ  |  _  n |  i ƒ  i ƒ  } |  i ƒ  } xy t t t	 | ƒ t	 | ƒ ƒ ƒ D]V } | | } | | } | d  j	 o/ |  i i
 | ƒ } |  i i |  i  | | ƒ qf qf Wd  S(   N(   R   R   R
   t   newdictR*   R   R4   t   ranget   minR)   R0   t   setitem(   R   t   varnamest   fastscope_wt   it   namet   w_valuet   w_name(    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyR.   c   s    " 

c         C   sê   |  i  d  j	 p t ‚ |  i ƒ  i ƒ  } d  g |  i } x t t t | ƒ |  i ƒ ƒ D]} } |  i	 i
 | | ƒ } y |  i	 i |  i  | ƒ } Wn8 t j
 o, } | i |  i	 |  i	 i ƒ p ‚  qÕ qX X| | | <qX W|  i | ƒ d  S(   N(   R   R   t   AssertionErrorR*   R   R+   R8   R9   R)   R
   R0   t   getitemR    t   matcht
   w_KeyErrorR6   (   R   R;   t   new_fastlocals_wR=   R@   R?   t   e(    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyR3   p   s     N(   R   R   R   R   R   R	   R/   R*   R1   R2   R   R4   R6   R.   R3   (    (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pyR(   7   s   									N(   R   t   pypy.interpreter.errorR    t   pypy.interpreter.baseobjspaceR   R   R(   (    (    (    s)   /64/home/arigo/u/pypy/interpreter/eval.pys   <module>   s   .
