U W½gk ã@sNddlZddlZddlZddlmZddlmZejs:t‚Gdd„deƒZ dS)éNé)ÚTestCase)Úfails_leakcheckc@s0eZdZdd„Zdd„Zdd„Zedd„ƒZd S) ÚGCTestscCsbt t tj¡ ¡¡}t ¡|ƒdk rBddl}td|  |ƒ¡ƒ|  |ƒ¡|  tj tj ¡dS)NrzO IS NOT NONE.) ÚweakrefÚrefÚgreenletÚ getcurrentÚswitchÚgcÚcollectÚsysÚprintÚ getrefcountÚ assertIsNoneÚ assertFalseÚgarbage)ÚselfÚor ©rúF/opt/hc_python/lib64/python3.8/site-packages/greenlet/tests/test_gc.pyÚtest_dead_circular_refs  zGCTests.test_dead_circular_refcCsPGdd„dtjƒ}|ƒ}||_t |¡}t ¡| |ƒ¡| tjtj¡dS)Nc@seZdZdZdS)z9GCTests.test_circular_greenlet..circular_greenletN)Ú__name__Ú __module__Ú __qualname__rrrrrÚcircular_greenletsr) rrrrr r rrr)rrrrrrÚtest_circular_greenlets  zGCTests.test_circular_greenletcCsJGdd„dtjƒ}|ƒ}t |¡}t ¡| |ƒ¡| tjtj¡dS)Nc@seZdZdd„Zdd„ZdS)z4GCTests.test_inactive_ref..inactive_greenletcSstjj||jddS)N)Úrun)rÚ__init__r©rrrrr$sz=GCTests.test_inactive_ref..inactive_greenlet.__init__cSsdS©Nrrrrrr'sz8GCTests.test_inactive_ref..inactive_greenlet.runN)rrrrrrrrrÚinactive_greenlet#sr!)rrrr r rrr)rr!rrrrÚtest_inactive_ref"s   zGCTests.test_inactive_refcsdGdd„dtƒ‰g}t ¡‰‡‡fdd„}t |¡}||_| |¡| ¡~~t ¡t ¡dS)Nc@seZdZdd„ZdS)z;GCTests.test_finalizer_crash..object_with_finalizercSsdSr rrrrrÚ__del__CszCGCTests.test_finalizer_crash..object_with_finalizer.__del__N)rrrr#rrrrÚobject_with_finalizerBsr$csLˆƒt ¡_z0z ˆ ¡Wntjk r8tdƒYnXW5t ¡`XdS)NzGot greenlet exit!)rr Úobjectr Z GreenletExitrr©r$ÚparentrrÚ greenlet_bodyGs   z3GCTests.test_finalizer_crash..greenlet_body)r%rr ÚarrayÚappendr r r )rr)r(Úgrr&rÚtest_finalizer_crash/s  zGCTests.test_finalizer_crashN)rrrrrr"rr,rrrrrs    r) r rrÚrZ leakcheckrZGREENLET_USE_GCÚAssertionErrorrrrrrÚs