Ñò
ïžòKc           @   sÄ   d  Z  d g Z d d k Z g  Z d „  Z d „  Z e e d ƒ o e e i ƒ n e e _ e d j oV d „  Z	 d	 „  Z
 d d
 „ Z e e	 ƒ e e
 d ƒ e e d d ƒ e e d ƒ n d S(   sœ   
atexit.py - allow programmer to define multiple exit functions to be executed
upon normal program termination.

One public function, register, is defined.
t   registeriÿÿÿÿNc          C   s¿   d }  x‰ t o� t i ƒ  \ } } } y | | | Ž  Wq	 t j
 o t i ƒ  }  q	 d d k } t i d IJ| i ƒ  t i ƒ  }  q	 Xq	 W|  d j	 o |  d |  d |  d ‚ n d S(   s‰   run any registered exit functions

    _exithandlers is traversed in reverse order so functions are executed
    last in, first out.
    iÿÿÿÿNs   Error in atexit._run_exitfuncs:i    i   i   (	   t   Nonet   _exithandlerst   popt
   SystemExitt   syst   exc_infot	   tracebackt   stderrt	   print_exc(   R   t   funct   targst   kargsR   (    (    s   scripts/common/Lib/atexit.pyt   _run_exitfuncs   s     
c         O   s   t  i |  | | f ƒ |  S(   s  register a function to be executed upon normal program termination

    func - function to be called at exit
    targs - optional arguments to pass to func
    kargs - optional keyword arguments to pass to func

    func is returned to facilitate usage as a decorator.
    (   R   t   append(   R
   R   R   (    (    s   scripts/common/Lib/atexit.pyR    %   s    	t   exitfunct   __main__c           C   s	   d GHd  S(   Ns
   running x1(    (    (    (    s   scripts/common/Lib/atexit.pyt   x17   s    c         C   s   d |  f GHd  S(   Ns   running x2(%r)(    (   t   n(    (    s   scripts/common/Lib/atexit.pyt   x29   s    c         C   s   d |  | f GHd  S(   Ns   running x3(%r, kwd=%r)(    (   R   t   kwd(    (    s   scripts/common/Lib/atexit.pyt   x3;   s    i   i   t   bars   no kwd args(   t   __doc__t   __all__R   R   R   R    t   hasattrR   t   __name__R   R   R   R   (    (    (    s   scripts/common/Lib/atexit.pyt   <module>   s    						
