mς
­fIc           @   sΫ  d  k  l Z l Z l Z l Z d k Z d k Z d k Z d   Z d   Z	 d   Z
 d   Z d   Z d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d f  d     YZ d   Z d f  d     YZ d   Z d f  d     YZ d   Z d e  f d     YZ! d   Z" d  e  f d!     YZ# d"   Z$ d#   Z% d$ e  f d%     YZ& d& e  f d'     YZ' d(   Z( d)   Z) d*   Z* d+   Z+ d,   Z, e,   d S(-   (   s   verifys   verboses
   TestFaileds   vereqNc         C   s+   |  | j o t d | |  | f  n d  S(   Ns   test_%s: actual %r, expected %r(   t   actualt   expectedt
   TestFailedt   name(   R    R   R   (    (    t)   /mit/python/lib/python2.4/test/test_gc.pyt   expect   s    c         C   s"   |  d j o t d |  n d  S(   Ni    s   test_%s: unexpected zero(   R    R   R   (   R    R   (    (    R   t   expect_nonzero   s    c         C   s.   t  o d |  Gn |   t  o	 d GHn d  S(   Ns   testing %s...t   ok(   t   verboseR   t   thunk(   R   R	   (    (    R   t   run_test   s
    c          C   s:   g  }  |  i |   t i   ~  t t i   d d  d  S(   Ni   t   list(   t   lt   appendt   gct   collectR   (   R   (    (    R   t	   test_list   s
    
c          C   s7   h  }  |  |  d <t i   ~  t t i   d d  d  S(   Ni   t   dict(   t   dR   R   R   (   R   (    (    R   t	   test_dict   s
    

c          C   sF   g  }  |  f } |  i |  t i   ~ ~  t t i   d d  d  S(   Ni   t   tuple(   R   t   tR   R   R   R   (   R   R   (    (    R   t
   test_tuple$   s    	
c          C   s@   d f  d     Y}  |  |  _ t i   ~  t t i   d  d  S(   Nt   Ac           B   s   t  Z RS(   N(   t   __name__t
   __module__(    (    (    R   R   /   s   t   class(   R   t   aR   R   R   (   R   (    (    R   t
   test_class.   s
    	
c          C   s:   d t  f d     Y}  t i   ~  t t i   d  d  S(   NR   c           B   s   t  Z RS(   N(   R   R   (    (    (    R   R   7   s   t   staticclass(   t   objectR   R   R   R   (   R   (    (    R   t   test_newstyleclass6   s    
c          C   sI   d f  d     Y}  |    } | | _ t i   ~ t t i   d  d  S(   NR   c           B   s   t  Z RS(   N(   R   R   (    (    (    R   R   >   s   t   instance(   R   R   R   R   R   (   R   R   (    (    R   t   test_instance=   s    		
c          C   sώ   d t  f d     Y}  |    } | | _ t i   ~ t t i   d  d t f d     Y} d | |  f d     Y} |   } | | _ t i   ~ t t i   d  ~ ~ t t i   d	  |    |  _ ~  t t i   d
  t	 t i   d d  d  S(   NR   c           B   s   t  Z RS(   N(   R   R   (    (    (    R   R   G   s   t   newinstancet   Bc           B   s   t  Z RS(   N(   R   R   (    (    (    R   R#   N   s   t   Cc           B   s   t  Z RS(   N(   R   R   (    (    (    R   R$   P   s   s   newinstance(2)s   newinstance(3)s   newinstance(4)i    s   newinstance(5)(
   R   R   R   R   R   R   R   R#   R$   R   (   R   R   R$   R#   (    (    R   t   test_newinstanceF   s&    		
		
c          C   s@   d f  d     Y}  |    } t i   ~ t t i   d  d  S(   NR   c           B   s   t  Z d   Z RS(   Nc         C   s   |  i |  _ d  S(   N(   t   selft   __init__t   init(   R&   (    (    R   R'   a   s    (   R   R   R'   (    (    (    R   R   `   s   t   method(   R   R   R   R   R   (   R   R   (    (    R   t   test_method^   s
    	
c          C   sΘ   d f  d     Y}  d f  d     Y} |    } | | _ t |  } |   } | | _ t i   ~ ~ t t i   d  x8 t i	 D]$ } t |  | j o | ` Pq q Wt d  t i	 i |  d  S(   NR   c           B   s   t  Z d   Z RS(   Nc         C   s   d  S(   N(    (   R&   (    (    R   t   __del__l   s    (   R   R   R+   (    (    (    R   R   k   s   R#   c           B   s   t  Z RS(   N(   R   R   (    (    (    R   R#   m   s   t	   finalizers&   didn't find obj in garbage (finalizer)(   R   R#   R   t   idt   id_at   bR   R   R   t   garbaget   objR   t   remove(   R   R   R#   R1   R.   R/   (    (    R   t   test_finalizerh   s$    				

 		c          C   sΞ   d t  f d     Y}  d t  f d     Y} |    } | | _ t |  } |   } | | _ t i   ~ ~ t	 t i   d  x8 t i
 D]$ } t |  | j o | ` Pq q Wt d  t i
 i |  d  S(   NR   c           B   s   t  Z d   Z RS(   Nc         C   s   d  S(   N(    (   R&   (    (    R   R+      s    (   R   R   R+   (    (    (    R   R      s   R#   c           B   s   t  Z RS(   N(   R   R   (    (    (    R   R#      s   R,   s&   didn't find obj in garbage (finalizer)(   R   R   R#   R   R-   R.   R/   R   R   R   R0   R1   R   R2   (   R   R   R#   R1   R.   R/   (    (    R   t   test_finalizer_newclass   s$    				

 		c          B   s5   h  }  d |  Ue i   ~  e e i   d d  d  S(   Ns   def f(): pass
i   t   function(   R   R   R   R   (   R   (    (    R   t   test_function   s
    
c          C   s4   d   }  t i   |    t t i   d d  d  S(   Nc          C   s   t  i   }  d  S(   N(   t   syst	   _getframet   frame(   R9   (    (    R   t   f’   s    i   R9   (   R:   R   R   R   (   R:   (    (    R   t
   test_frame‘   s    	
c          C   s―   t  i   t t  i g   g  }  |  i |   t |   } t  i   } t  i
 | t  i B ~  t  i   t  i
 |  t t t  i  d  t  i i   } t t |  |  d  S(   Ni   (   R   R   t   vereqR0   t   LR   R-   t   id_Lt	   get_debugt   debugt	   set_debugt   DEBUG_SAVEALLt   lent   popR1   (   R=   R>   R@   R1   (    (    R   t   test_saveall©   s    

c          C   s]   t  i   } t  i   t  i d  d f  d     Y}  |    } ~ t  i   t  i |   d  S(   Ni   R   c           B   s   t  Z d   Z RS(   Nc         C   s   t  |   d  S(   N(   t   dirR&   (   R&   (    (    R   R+   Η   s    (   R   R   R+   (    (    (    R   R   Ζ   s   (   R   t   get_thresholdt
   thresholdst   enablet   set_thresholdR   R   t   disable(   R   R   RH   (    (    R   t   test_delΐ   s    
	
c          C   s`   t  i   } t  i   t  i d  d t f d     Y}  |    } ~ t  i   t  i |   d  S(   Ni   R   c           B   s   t  Z d   Z RS(   Nc         C   s   t  |   d  S(   N(   RF   R&   (   R&   (    (    R   R+   Φ   s    (   R   R   R+   (    (    (    R   R   Υ   s   (	   R   RG   RH   RI   RJ   R   R   R   RK   (   R   R   RH   (    (    R   t   test_del_newclassΟ   s    
	
t   Ouchc           B   s   t  Z d Z d   Z RS(   Ni    c         C   s6   t  i d t  _ t  i d d j o t i   n d  S(   Ni   i   i    (   RN   t   nR   R   (   R&   (    (    R   R+   ΰ   s    (   R   R   RO   R+   (    (    (    R   RN   ή   s   c          C   sΕ   t  i   d } x€ t d  D] }  g  } x# t |  D] } | t   g } q6 Wg  } x# t |  D] } | t   g } qb Wh  } x/ t |  D]! } h  d | <d t   <} q Wq Wt  i
   d  S(   Ni   i   i   (   R   RI   t   Nt   ranget   countR   t   iRN   t   ut   vRK   (   RR   RS   RP   R   RU   RT   (    (    R   t   test_trashcanε   s"    
    #t   Boomc           B   s   t  Z d   Z RS(   Nc         C   s   |  ` t  d  S(   N(   R&   t   attrt   AttributeError(   R&   t   someattribute(    (    R   t   __getattr__  s    (   R   R   R[   (    (    (    R   RW     s   c          C   sv   t    }  t    } | |  _ |  | _ t i   t t i  } ~  ~ t	 t i   d d  t	 t t i  | d  d  S(   Ni   t   boom(
   RW   R   R/   RX   R   R   RC   R0   t
   garbagelenR   (   R   R/   R]   (    (    R   t	   test_boom  s    				
t   Boom2c           B   s   t  Z d   Z d   Z RS(   Nc         C   s   d |  _ d  S(   Ni    (   R&   t   x(   R&   (    (    R   R'     s    c         C   s3   |  i d 7_ |  i d j o
 |  ` n t  d  S(   Ni   (   R&   R`   RX   RY   (   R&   RZ   (    (    R   R[     s    
(   R   R   R'   R[   (    (    (    R   R_     s   	c          C   sv   t    }  t    } | |  _ |  | _ t i   t t i  } ~  ~ t	 t i   d d  t	 t t i  | d  d  S(   Ni   t   boom2(
   R_   R   R/   RX   R   R   RC   R0   R]   R   (   R   R/   R]   (    (    R   t
   test_boom2#  s    				
t   Boom_Newc           B   s   t  Z d   Z RS(   Nc         C   s   |  ` t  d  S(   N(   R&   RX   RY   (   R&   RZ   (    (    R   R[   8  s    (   R   R   R[   (    (    (    R   Rc   7  s   c          C   sv   t    }  t    } | |  _ |  | _ t i   t t i  } ~  ~ t	 t i   d d  t	 t t i  | d  d  S(   Ni   t   boom_new(
   Rc   R   R/   RX   R   R   RC   R0   R]   R   (   R   R/   R]   (    (    R   t   test_boom_new<  s    				
t	   Boom2_Newc           B   s   t  Z d   Z d   Z RS(   Nc         C   s   d |  _ d  S(   Ni    (   R&   R`   (   R&   (    (    R   R'   I  s    c         C   s3   |  i d 7_ |  i d j o
 |  ` n t  d  S(   Ni   (   R&   R`   RX   RY   (   R&   RZ   (    (    R   R[   L  s    
(   R   R   R'   R[   (    (    (    R   Rf   H  s   	c          C   sv   t    }  t    } | |  _ |  | _ t i   t t i  } ~  ~ t	 t i   d d  t	 t t i  | d  d  S(   Ni   t	   boom2_new(
   Rf   R   R/   RX   R   R   RC   R0   R]   R   (   R   R/   R]   (    (    R   t   test_boom2_newR  s    				
c          C   s1  d d d g } t i |  } | i   t | | d  t |  }  t i |   } | i   t | | d  h  d d <d d <} d d d d g } t i |  } | i   t | | d  t i d d g h  d d <d  } | i   t | d d g t
 d  d  t t i d d	 d
  g  d  d  S(   Ni   i   i   t   get_referentsi   i   i   i    R   x0.04.0(   i    i    i    (   t   alistR   Ri   t   gott   sortR   R   t   atuplet   adictR   RQ   (   Rm   Rj   Rn   R   Rk   (    (    R   t   test_get_referents^  s"    


$
 t   C1055820c           B   s   t  Z d   Z RS(   Nc         C   s   | |  _  |  |  _ d  S(   N(   RS   R&   t   loop(   R&   RS   (    (    R   R'   {  s    	(   R   R   R'   (    (    (    R   Rp   z  s   t   GC_Detectorc           B   s   t  Z d   Z RS(   Nc            s4   t    _   d   } t i t d  |    _ d  S(   Nc            s   t    _ d  S(   N(   t   TrueR&   t   gc_happened(   t   ignored(   R&   (    R   t   it_happened  s    i  (   t   FalseR&   Rt   Rv   t   weakreft   refRp   t   wr(   R&   Rv   (    (   R&   R   R'     s    	(   R   R   R'   (    (    (    R   Rr     s   c             sΰ   g       d   } g  } t d  D] } | t |  q& ~ } g  } | D] }  | t i	 |  |  qM ~  d  }  t i   t t    d d  d  } t i   t t    d d  x   D] } t | d  d  qΒ Wd  S(   Nc            s)   g  }   D] } | |   q ~  (d  S(   N(   t   _[1]t   WRsRz   t   ouch(   Ru   R{   Rz   (   R|   R}   (    R   t   callback  s    i   i    t   bug1055820b(   R}   R~   R{   RQ   RS   Rp   t   Cst   cRx   Ry   R|   t   NoneR   R   R   RC   R`   (   R   RS   R}   R{   R~   R|   R   R`   (    (   R}   R|   R   t   test_bug1055820b  s    --

 c             s-  t  d  }	 t i   t  d  } |	 | _ |	 ` t  d  } t i	 |    g      d   } t i	 |	 |  } d  }	 } } g  } d } t   }
 xY |
 i pN | d 7} | d j o t d   n t t   d d  | i g   q Wt t   d d  x  D] }  t |  d  d  qWd  S(   Ni    i   i   c            s       g  (d  S(   N(   t   c2wrR}   (   Ru   (   R   R}   (    R   R~   ΄  s    i'  s'   gc didn't happen after 10000 iterationst   bug1055820c(   Rp   t   c0R   R   t   c1t   keep_c0_aliveRq   t   c2Rx   Ry   R   R}   R~   t   c0wrR   t   junkRS   Rr   t   detectorRt   R   R   RC   R   R`   (   R`   R   R   R   RS   R}   R~   R   R   R   R   (    (   R   R}   R   t   test_bug1055820c₯  s2    
	 	 

 c    
         s(  g   d t f    d     Y} | d  }	 t i   t d  } |	 | _ |	 ` t d  } t
 i |    d  }	 } } t   } g  } d } xY | i pN | d 7} | d j o t d   n t t   d d  | i g   q Wt t   d d  x  D] }  t |  d  d  q
Wd  S(	   Nt   Dc              s   t  Z    d   Z RS(   Nc            s       g  (d  S(   N(   R   R}   (   R&   (   R   R}   (    R   R+   ρ  s    (   R   R   R+   (    (   R   R}   (    R   R   π  s   i    i   i   i'  s'   gc didn't happen after 10000 iterationst   bug1055820d(   R}   Rp   R   t   d0R   R   R   t   keep_d0_aliveRq   R   Rx   Ry   R   R   Rr   R   R   RS   Rt   R   R   RC   R   R`   (
   R`   R   R   R   RS   R}   R   R   R   R   (    (   R   R}   R   t   test_bug1055820dκ  s0    
		 

 c           C   s~  t  i   t d t  t d t  t d t  t d t  t d t  t d t  t d t	  t d t
  t d	 t  t d
 t  t d t  t d t  t d t  t d t  t d t  t d t  t d t  t d t  t d t  t d t  t d t  t d t  t  i   z t d t  Wd  t  i   Xt  i   z t d t  Wd  t  i   Xd  S(   Nt   listst   dictst   tuplest   classess   new style classest	   instancess   new instancest   methodst	   functionst   framest
   finalizerss   finalizers (new class)R+   s   __del__ (new class)t   saveallt   trashcanR\   Ra   Rd   Rg   Ri   R   R   R   (   R   R   R
   R   R   R   R   R   R!   R%   R*   R6   R;   R3   R4   RL   RM   RE   RV   R^   Rb   Re   Rh   Ro   R   RI   R   RK   R   (    (    (    R   t   test_all.  sB    

 
 c          C   s·   t  o	 d GHn t i   }  t i   t t i    t i   } t i | t i	 @ z t
   Wd  t i |  t  o	 d GHn t i   t t i    |  p t i   n Xd  S(   Ns   disabling automatic collections   restoring automatic collection(   R   R   t	   isenabledt   enabledRK   t   verifyR?   R@   RA   t
   DEBUG_LEAKR   RI   (   R    R@   (    (    R   t   testS  s"    	
 	
(-   t   test.test_supportR‘   R   R   R<   R7   R   Rx   R   R   R
   R   R   R   R   R   R!   R%   R*   R3   R4   R6   R;   RE   RL   RM   RN   RV   RW   R^   R_   Rb   R   Rc   Re   Rf   Rh   Ro   Rp   Rr   R   R   R   R   R£   (+   R   R<   R   R4   R!   RM   R   R   R   R*   Rr   Rp   R   R‘   Rb   R   R   Rh   R_   R3   R6   R%   R7   R£   R   Rc   RE   R
   R   R   R   Re   RN   R   Rx   R^   RV   RL   Rf   R;   R   Ro   RW   (    (    R   t   ?   sP   									
						
										
		
				E	D	%	