f ž _&c@s€ddlZddlZddlZddlZddlZddlZddlmZz ddlZWne y^dZYn0ddl m Z dd„Z dd„Z dS)éN)Úsupport)Úsetup_unraisable_hookc Cs ztj ¡}Wnttfy(d}YnZ0tjd|dg}ttdƒrR|  tj ¡ttdƒrh|  tj ¡|D]}tj |d|dqlt ƒt tj¡|jr²tj dtj |j¡¡tj ¡D]P}t|dƒrðt|jƒD]\}}tj |¡|j|<qÔt|ddƒr¼tj |j¡|_q¼|jrd tj_|j dur6t !|j ¡|j"durNt# $|j"¡t %|j&ob|j&d k¡|j't_'ttd ƒrŒd d „}t (|¡t)ƒ|j*durt+tj,|j*dƒt_,t+tj-|j*dƒt_-t.tj/|j*ƒt_/t.tj0|j*ƒt_0t.tj,|j*ƒt_,t.tj-|j*ƒt_-dS)NT)Z all_threadsÚfileÚSIGALRMÚSIGUSR1)ZchainrrÚ__path__Ú__file__FiÚ addaudithookcSsdS©N©)ZnameZargsr r ú//usr/lib64/python3.10/test/libregrtest/setup.pyÚ_test_audit_hookNsz%setup_tests.._test_audit_hooki(i)1ÚsysZ __stderr__ÚfilenoÚ ValueErrorZAttributeErrorÚ faulthandlerZenableZhasattrÚsignalZappendrrÚregisterÚreplace_stdoutrZrecord_original_stdoutÚstdoutZtestdirÚpathZinsertÚosZabspathZmodulesZvaluesZ enumeraterZgetattrrZ huntrleaksÚunittestZ BaseTestSuiteZ_cleanupZmemlimitZ set_memlimitZ thresholdÚgcZ set_thresholdZsuppress_msvcrt_assertsZverboseZ use_resourcesrrZtimeoutZmaxZ SHORT_TIMEOUTZ LONG_TIMEOUTZminZLOOPBACK_TIMEOUTZINTERNET_TIMEOUT)ZnsZ stderr_fdZsignalsZsignumZmoduleZindexrr r r r Ú setup_testssR                rcsZtj‰z ˆ ¡}Wnty&YdS0t|dˆjddddt_‡fdd„}t |¡dS) zˆSet stdout encoder error handler to backslashreplace (as stderr error handler) to avoid UnicodeEncodeError when printing a tracebackNZwZbackslashreplaceFZ )ÚencodingZerrorsZclosefdZnewlinecstj ¡ˆt_dSr )r rZcloser ©rr r Úrestore_stdoutts z&replace_stdout..restore_stdout)r rrrZopenrÚatexitr)Zfdrr rr r`s  ü r)rrrrr rZtestrrZ ImportErrorZtest.libregrtest.utilsrrrr r r r Zs     P