Rh8< dZedk7redddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZgdZdZdZdZd Zej,j/ej,j1eZej,j/eZej,j/eZej,j/eZGd d eZGd d eZ Gdde Z!GddeZ"GddejFZ$dZ%dZ&dZ'dZ(dZ)da*da+dZ,dZ-da.dZ/dZ0dZ1dZ2dZ3ddZ4dZ5d Z6d!Z7d"Z8dd#Z9ddddd$d%Z:dddddd$d&Z;e:d'(Zd+Z?d,Z@ejeBjd-jd.d/ZEdd0ZFdd1ZGdd2ZHdd3ZId4ZJdd5ZKd6ZLe jd7k(ZNe jjd8ZOePe d9ZQe jd:vreQrd;ndk(ZTePed?xreS xreT ZUd@ZVeS xreT ZWdAZXeS xreT ZYddBdCZZdZ[e jd7k7r e jdDdDk7Z[dEZ^dZ_dZ`ej,jedFZbdGZcddHZddIZedJefdKegefehffdLZiddddMdNZjdOZkejdPZmdQZndRZodSZpdTZqejdUZrdVZsdWZtdXZudYZvePe dZrd[euzZud\Zveud]zZwd^Zxd_Zyd`ZzdaZ{dbZ|ejdcZ}ddZ~deZdfezZdgezZdhezZe jZdiefdKefdjZdiefdKdfdkZGdldmZddnZdoZdpZdqZdrZddsZdtZduZdvZdwZdxZdyZdzZexr%e jd7k7xre j,d{ Zejduxre Zejed|Zd}Zd~Ze j8e_dadZejdZejdZdZdZGddehZdadZGddZdZdddZ ddZddZGddZdZejdZdZdddZdZddZgfdZdadZdZejdZGddZdZGddZeZGddZeZej|GddZeZej|GddZeZdZe jjZedvsJdZGddZdddZdZdZdZdZejdZddZdefdefdKehfdZdehdKdfdZdZejdZejdZePe dZdZdd'ddZdddd'dœdÄZejdĄZdZereTrdZn`dZn]eTrdZnXePedȫr#ejjdk(rdZn,e jjd˫rdZne:d'(rdZndZejePedȫxr ejjdk(dϫZeddhZd҄Zy#e]$rYwxYw)z7Supporting definitions for the Python regression tests.z test.supportz.support must be imported from the test packageN)P PIPE_MAX_SIZEverbose max_memuse use_resourcesfailfastError TestFailed TestDidNotRunResourceDeniedrecord_original_stdoutget_original_stdoutcaptured_stdoutcaptured_stdincaptured_stderris_resource_enabledrequiresrequires_freebsd_versionrequires_linux_versionrequires_mac_vercheck_syntax_error requires_gzip requires_bz2 requires_lzma bigmemtestbigaddrspacetest cpython_only get_attributerequires_IEEE_754 requires_zlibhas_fork_support requires_forkhas_subprocess_supportrequires_subprocesshas_socket_supportrequires_working_socketanticipate_failureload_package_testsdetect_api_mismatch check__all__skip_if_buggy_ucrt_strfptimecheck_disallow_instantiationcheck_sanitizerskip_if_sanitizerrequires_limited_apirequires_specialization MS_WINDOWS is_jython is_android is_emscriptenis_wasicheck_impl_detail unix_shellsetswitchinterval get_pagesizeopen_urlresource reap_childrenrun_with_locale swap_itemfindfileinfinite_recursion swap_attrMatcher set_memlimitSuppressCrashReportsortdict run_with_tzPGOmissing_compiler_executable ALWAYS_EQNEVER_EQLARGESTSMALLESTLOOPBACK_TIMEOUTINTERNET_TIMEOUT SHORT_TIMEOUT LONG_TIMEOUTPy_DEBUGEXCEEDS_RECURSION_LIMITC_RECURSION_LIMIT skip_on_s390xg$@gN@g>@gr@ceZdZdZy)rz*Base class for regression test exceptions.N__name__ __module__ __qualname____doc__,/usr/lib/python3.12/test/support/__init__.pyrrks4rZrc.eZdZdZddfd ZdZxZS)r Test failed.NstatscB||_||_t| |g|yN)msgr_super__init__)selfrbr_args __class__s r[rdzTestFailed.__init__ps#  $t$rZc|jSra)rbres r[__str__zTestFailed.__str__us xxrZ)rUrVrWrXrdrj __classcell__rgs@r[r r ns)-% rZr c"eZdZdZfdZxZS)TestFailedWithDetailsr]cH||_||_t| ||||y)Nr^)errorsfailuresrcrd)rerbrprqr_rgs r[rdzTestFailedWithDetails.__init__zs'    fhez$anticipate_failure..sQrZ)unittestexpectedFailure) conditions r[r&r&s ''' rZcd|d}t}|j|||}|j||S)zGeneric load_tests implementation for simple test packages. Most packages can implement load_tests using this function as follows: def load_tests(*args): return load_package_tests(os.path.dirname(__file__), *args) ztest*) start_dir top_level_dirpattern) STDLIB_DIRdiscoveraddTests)pkg_dirloaderstandard_testsr~top_dir package_testss r[r'r'sDGOOg29,3$5MM* rZcp t||}|S#t$rtjd|d|wxYw)z?Get an attribute, raising SkipTest if AttributeError is raised.zobject z has no attribute )getattrAttributeErrorrxSkipTest)objname attributes r[rrsDC&  O3 MNNOs %5Fc|ayra)_original_stdout)stdouts r[r r srZc2txstjSra)rsysrrYrZr[r r s  )szz)rZc ||S#t$r3}tdk\r$t|jjd|d}~wt $rz}tdk\r>t|jjd|td|j|t j|tj||cYd}~Sd}~wwxYw)N: zre-run ) FileNotFoundErrorrprintrgrUOSErroroschmodstatS_IRWXU)pathfuncrferrs r[ _force_runrs T{  a< cmm44c: ;  a< cmm44c: ; 4==$7 8 t||$T{ s% C.> C A/B?9C?Cc ttdrtjSddl}d}tjj dr|j rd}ntjj drddlddld}d}Gfddj}jj}|j}|sj|}jj}|j!||j#|j%|j#|} | sjt'|j(|zsd}ntjd k(rdd lm} mm} m } dd lm} | j5| d }|j7dk(rd }nFGfdd| }|}| |}|j9|dks|j;|dkrd}|s> ddlm}|}|jA|jC|jE|t_)| t_tjS#tF$rP}tI|}tK|dkDr|dddz}djMtO|jP|}Yd}~{d}~wwxYw)Nresultrwinz(gui is not available on Windows IoT CorerceZdZdWjjfdWjjfdWjj fgZy)*_is_gui_available..USEROBJECTFLAGSfInherit fReserveddwFlagsN)rUrVrWwintypesBOOLDWORD_fields_)ctypessr[USEROBJECTFLAGSrs@#V__%9%9:$foo&:&:;"FOO$9$9:.ProcessSerialNumber highLongOfPSN lowLongOfPSNN)rUrVrWr)rsr[ProcessSerialNumberrs,e4+U35rZrz#cannot run without OS X gui process)Tk2z [...]zTk unavailable due to {}: {})*hasattr_is_gui_availablerplatformr startswith win32_is_iotrctypes.wintypesrwindlluser32GetProcessWindowStationWinErrorrrGetUserObjectInformationWbyrefsizeofboolrrrr ctypes.utilr LoadLibraryCGMainDisplayIDGetCurrentProcessSetFrontProcesstkinterrwithdrawupdatedestroy ExceptionstrlenformattyperUreason)rr UOI_FLAGS WSF_VISIBLErdllhuofneededresrrrr app_servicesrpsnpsn_prroote err_stringrrs @@r[rrs\ (+ ''' F ||u%(*?*?*A;   '      G "4D MMO KKM LLN &#)z  # ## GQJ:#'_x7 3::47;K;K;EGF  Gs=I%% J>.AJ99J>c&tduxs|tvS)zTest whether a resource is enabled. Known resources are set by regrtest.py. If not running under regrtest.py, all resources are assumed enabled unless use_resources has been set. N)rresources r[rr!s D =H $==rZct|s|d|z}t||dvrts td|dk(r$tsttjyy)z@Raise ResourceDenied if the specified resource is not available.Nz"Use of the %r resource not enabled>networkurlfetchzNo socket supportgui)rr r$rr)rrbs r[rr)sd x ( ;6ACS!!**3E0115!2!4.5566"5rZctddl}djtt|}|j j ddd}|j |k(r/ ttt|j d}||k}nd}tj||d|d|S#t$rd}Y+wxYw) zDecorator raising SkipTest if the OS is `sysname` and the version is less than `min_version`. For example, @_requires_unix_version('FreeBSD', (7, 2)) raises SkipTest if the FreeBSD version is less than 7.2. rN.-rFz version  or higher required, not ) rjoinmaprreleasesplitsystemtupleint ValueErrorrxskipIf)sysname min_versionrmin_version_txt version_txtversionskips r[_requires_unix_versionr4shhs3 45O""$**3215KG# )C[%6%6s%;<=G[(D ?? )9_--F -   D s(B)) B76B7ctd|S)zDecorator raising SkipTest if the OS is FreeBSD and the FreeBSD version is less than `min_version`. For example, @requires_freebsd_version(7, 2) raises SkipTest if the FreeBSD version is less than 7.2. FreeBSDrrs r[rrOs ")[ 99rZctd|S)zDecorator raising SkipTest if the OS is Linux and the Linux version is less than `min_version`. For example, @requires_linux_version(2, 6, 32) raises SkipTest if the Linux version is less than 2.6.32. Linuxrrs r[rrXs "'; 77rZcfd}|S)zDecorator raising SkipTest if the OS is Mac OS X and the OS X version if less than min_version. For example, @requires_mac_ver(10, 5) raises SkipTest if the OS X version is lesser than 10.5. cTtjfd}|_|S)NcVtjdk(rddl}|jd} tt t |j d}|kr:djt t}tjd|d||i|S#t$rYwxYw)Nrrrz Mac OS X r) rrmac_verrrrrrrrxrr)rfkwrrrrrrs r[wrapperz4requires_mac_ver..decorator..wrapperis||x'&..03  >#C[->->s-C$DEG,*-((3sK3H*I&//. =>>$$ $"s(B B('B() functoolswrapsr)rrrs` r[ decoratorz#requires_mac_ver..decoratorhs-   %  %*rZrY)rrs` r[rras& rZcddl}|sd} |jjdk(}tj||S#ttf$r*}t j d|dtd}Yd}~Jd}~wwxYw)z4Decorator raising SkipTest if running on a buildbot.rNznot suitable for buildbotsbuildbotzgetpass.getuser() failed rF) getpassgetuserlowerKeyErrorEnvironmentErrorwarningswarnRuntimeWarningrxr)rr isbuildbotrs r[skip_if_buildbotr~st -__&,,.*<  ??:v .. & ' 1#a8.I s!AA: A55A:addressmemoryubthreadc|s|s|s |s tdtjdxsd}tjdxsd}d|vxsd|v}d|vxsd|v}d |vxsd |v}d |vxsd |v} |xr|xs|xr|xs|xr|xs|xr| S) z9Returns True if Python is compiled with sanitizer supportz:At least one of address, memory, ub or thread must be TrueCFLAGS CONFIG_ARGSz-fsanitize=memoryz--with-memory-sanitizerz-fsanitize=addressz--with-address-sanitizerz-fsanitize=undefinedz#--with-undefined-behavior-sanitizerz-fsanitize=threadz--with-thread-sanitizer)r sysconfigget_config_var) rr r!r"cflags config_argsmemory_sanitizeraddress_sanitizer ub_sanitizerthread_sanitizers r[r,r,s vvUVV % %h / 52F**=9?RKv% 1![0 & 2"k1 &( =-< v% 1![0  $$ &  && &   &  $$ rZcT|sd}t||||}tj||S)z>Decorator raising SkipTest if running with a sanitizer active.z"not working with sanitizers activer)r,rxr)rrr r!r"rs r[r-r-s+ 5 76b PD ??4 ((rZT)rcFdD]}||vr||xxd|z cc<|||<y)N) ASAN_OPTIONS MSAN_OPTIONS UBSAN_OPTIONS TSAN_OPTIONS:rY)envoptionrs r[set_sanitizer_env_varr8s5Q 3; I1VH %ICI rZcBtjfd}|S)z5Skip the test on TLS certificate validation failures.c |i|y#t$r(}dt|vrtjdd}~wwxYw)NCERTIFICATE_VERIFY_FAILEDz.system does not contain necessary certificates)rrrxr)rfkwargsrrvs r[decz&system_must_validate_cert..decsO  t v  *c!f4'')ABB   s =#8=)rr)rvr=s` r[system_must_validate_certr>s%__Q JrZi@idoubleIEEEztest requires IEEE 754 doublescZ ddl}tj||S#t$rd}Y#wxYwNr)zlib ImportErrorrx skipUnless)rrCs r[rr5   tV ,,   **cZ ddl}tj||S#t$rd}Y#wxYwrB)gziprDrxrE)rrIs r[rrrFrGcZ ddl}tj||S#t$rd}Y#wxYwrB)bz2rDrxrE)rrKs r[rrs5   sF ++ rGcZ ddl}tj||S#t$rd}Y#wxYwrB)lzmarDrxrE)rrMs r[rrrFrGc ddl}|j }t |d S#t$rtjdwxYw)Nr_testinternalcapi requiredcode_debug_ranges)_testinternalcapirDrxr get_configr)rQconfigs r[has_no_debug_rangesrTsQ>  ) ) +FF./0 00 > <==>s %Ac>tjt|Sra)rxrrT)rs r[requires_debug_rangesrVs ??.0& 99rZc^ ddlm}tj|dS#t$rd}Y#wxYw)Nrunicode_legacy_stringzrequires legacy Unicode C API) _testcapirYrDrxrErXs r[requires_legacy_unicode_capir[s>%3   4> @@ % $%s  ,,win32javagetandroidapilevel)r\vxworksz/system/bin/shz/bin/sh emscriptenwasiforkc6tjtdS)Nzrequires working os.fork())rxrEr rYrZr[r!r!!s   /1M NNrZc6tjtdS)z3Used for subprocess, os.spawn calls, fd inheritancezrequires subprocess support)rxrEr"rYrZr[r#r#&s   57T UUrZ)modulecvd}|rtstj|ytjt|S)zSkip tests or modules that require working sockets Can be used as a function/class decorator or to skip an entire module. zrequires socket supportN)r$rxrrE)rerbs r[r%r%-s; $C !##C( ("""#5s;;rZz%4Yzhttp://www.pythontest.netdatactjdk7ryddl}d}|d}|j\}}t |j |dt |t d|zy)zOAssure user that loud errors generated by macOS libc's malloc are expected.rNrz NOTICE z may generate "malloc can't allocate region" warnings on macOS systems. This behavior is known. Do not report a bug unless tests are also failing. See https://github.com/python/cpython/issues/85100r)rrshutilget_terminal_sizercenter) test_namerirbdetailpadding_s r[darwin_malloc_err_warningrpRsh ||x C CCF ))+JGQ #**Wc "# &M #-rZcPtjj|r|S| tjj||}tgt jz}|D]E}tjj||}tjj |sC|cS|S)a[Try to find a file on sys.path or in the test directory. If it is not found the argument passed to the function is returned (this does not necessarily signal failure; could still be the legitimate path). Setting *subdir* indicates a relative path to use to find the file rather than looking directly in the path directories. )rrisabsr TEST_HOME_DIRrexists)filenamesubdirrdnfns r[r=r=es ww}}X 77<<1 ?SXX %D) WW\\"h ' 77>>" by) OrZct|j}|Dcgc]}d|z }}dj|}d|zScc}w)z%Like repr(dict), but in sorted order.z%r: %rz, z{%s})sorteditemsr)dictr{pair reprpairs withcommass r[rCrCxsG 4::< E-23TD3I39%J J 4s AcodereturncHi}ttj|||S)zHRun a piece of code after dedenting it, and return its global namespace.)exectextwrapdedent)rnss r[run_coders B # IrZ)linenooffsetcr|jt|5}t|dddddj}|j |j ||j |j ||j |j||j |j|yy#1swYxYw)Nz r)assertRaisesRegex SyntaxErrorcompile exceptionassertIsNotNoner assertEqualr)testcase statementerrtextrrcmrs r[rrs  # #K 94R ?F34 ,,C SZZ( SZZ0 SZZ( SZZ044s B--B6c ddl}ddl}ddlm} ddl}j dd |jj|djdd}tjjt|} fd}tjj|r||} | | S||td t rt#d |zt% |j&j)} |r| j*j-d | j/|t0 } |r0| j2j5ddk(r|j7| } t/|d5} | j9} | r$| j;| | j9} | r$ddd| j=||} | | St?d|z#t $rd}YwxYw#1swYExYw#| j=wxYw)Nrr)unlinkcheckr/ct|gi}|S|r|jd|S|jyrB)openseekclose)rxrvrfrr s r[check_valid_filez*open_urlresource..check_valid_filesA  !d !b ! =H 1X FF1IH  rZrz fetching %s ...file)zAccept-EncodingrItimeoutzContent-EncodingrI)fileobjwbzinvalid resource %r) urllib.request urllib.parse os_helperrrIrDpopparseurlparserrrr TEST_DATA_DIRrtrrrr request build_opener addheadersappendrrLheadersgetGzipFilereadwriterr )urlrfr urllibrrIrurxrrvopeneroutsrs `` @r[r9r9s'! FF7D !E||$$S)!,2237;H mX .B ww~~b R  =Hr  Z !C'.A.CD ^^ ( ( *F   !<= C!1 2A  01V; MM!M $ "d^ sA ! FFH   A} *R/ 00_ H    s5G! G4-6G($G4 G%$G%(G1-G44Hc#Kddl}tt|}tt||j  tt|tt||y#tt||wxYww)zReturn a context manager used by captured_stdout/stdin/stderr that temporarily replaces the sys stream *stream_name* with a StringIO.rN)iorrsetattrStringIO) stream_namer orig_stdouts r[captured_outputrsS#{+K Cbkkm,/c;''[+.[+.s4A1A A1A..A1ctdS)zCapture the output of sys.stdout: with captured_stdout() as stdout: print("hello") self.assertEqual(stdout.getvalue(), "hello\n") rrrYrZr[rr 8 $$rZctdS)zCapture the output of sys.stderr: with captured_stderr() as stderr: print("hello", file=sys.stderr) self.assertEqual(stderr.getvalue(), "hello\n") stderrrrYrZr[rrrrZctdS)a Capture the input to sys.stdin: with captured_stdin() as stdin: stdin.write('hello\n') stdin.seek(0) # call test code that consumes from sys.stdin captured = input() self.assertEqual(captured, "hello") stdinrrYrZr[rrs 7 ##rZclddl}|j|j|jy)aForce as many objects as possible to be collected. In non-CPython implementations of Python, this is needed because timely deallocation is not guaranteed by the garbage collector. (Even in CPython this can be the case in case of reference cycles.) This means that __del__ methods may be called later than expected and weakrefs may remain alive for longer than expected. This function tries its best to force all garbage objects to disappear. rN)gccollect)rs r[ gc_collectrs"JJLJJLJJLrZc#Kddl}|j}|j d|r|jyy#|r|jwwxYwwrB)r isenableddisableenable)rhave_gcs r[ disable_gcrsG llnGJJL  IIK 7 IIK s%AAAAActjdxsd}d}|jD]}|jds|}|dvS)z,Find if Python was built with optimizations. PY_CFLAGSr%z-O)r%z-O0z-Og)r'r(rr)r) final_optopts r[python_is_optimizedrsP  % %k 2 8bFI||~ >>$ I . ..rZctjdxsdgd}tjd}|r|j|tfd|DS)NPY_CFLAGS_NODISTr%)z -fprofile-usez-fprofile-instr-usez -prof-usePGO_PROF_USE_FLAGc3&K|]}|v ywrarY).0r7 cflags_nodists r[ z#check_cflags_pgo..)sA6v&As)r'r(rany) pgo_optionsrrs @r[check_cflags_pgorsY,,-?@FBMK"001DE,- A[A AArZnP0n getobjects2P0PncHddl}|jt|ztzSrB)structcalcsize_header_alignfmtrs r[ calcobjsizer3s ??7S=61 22rZcHddl}|jt|ztzSrB)rr_vheaderrrs r[ calcvobjsizer7s ??8c>F2 33rZi@ic ddl}t j |}t |t k(r|jtzs.t |t k7r+t |jtzr||jz }dt |||fz}|j|||y#t$rtjdwxYw)NrrOz&wrong size for %s: got %d, expected %d) rQrDrxrr getsizeofr __flags___TPFLAGS_HEAPTYPE_TPFLAGS_HAVE_GCSIZEOF_PYGC_HEADr)testosizerQrrbs r[ check_sizeofr?s> ]]1 F aDq{{->> q'T/Q 1 14D D !222 2Aw% &CVT3' > <==>s B""Cc'2K ddl}t||}|j|}|D]} |j||n d|r|r|j|yyy#Y.decorator..innerqs : rzz!**T*!BJJt  G T*T*? 4('.BJJt$ #" :''(899 :? 4('.BJJt$ sBB;B8;=C8)rUrX)rrr s` r[rzrun_with_tz..decoratorps% ,   rZrY)r rs` r[rDrDos4 rZirlimitcFdttdtzd}tjd|tjtj z}|t d|tt|jd||jdjzS)Nr)kmgtz(\d+(?:\.\d+)?) (K|M|G|T)b?$zInvalid memory limit: rr) _1M_1Grematch IGNORECASEVERBOSErrfloatgroupr)rsizesrs r[_parse_memlimitr s    #X  E 0%+ -Ay1%;<< uQWWQZ 5)9)9);#<< ==rZcpt|}|tdz kr td|at |t }|ay)Nrz+Memory limit {limit!r} too low to be useful)r _2Grreal_max_memuseminMAX_Py_ssize_tr)rmemlimits r[rArAs<u%H#'FGGO8^,HJrZc"eZdZdZdZdZdZy)_MemoryWatchdogz`An object which periodically watches the process' memory consumption and prints it out. cddjtj|_d|_y)Nz/proc/{pid}/statm)pidF)rrgetpidprocfilestartedris r[rdz_MemoryWatchdog.__init__s$+22ryy{2C  rZcddl} t|jd}ddl }|5td}|jtj|g||j|_dddd|_y#t$rN}|jdj |t tjjYd}~yd}~wwxYw#1swYd|_yxYw)Nrrz!/proc not available for stats: {}zmemory_watchdog.py)rrT)rrr,rrrrrrflush subprocessr=Popen executableDEVNULL mem_watchdogr-)rerrvrr1watchdog_scripts r[startz_MemoryWatchdog.starts T]]C(A   L&';.decorator..wrappers<v?A*,  $w'MMO8MMOs ,CC)rrB)rvrrErBrs`@r[rzbigmemtest..decorators $: rZrY)rrBrErs``` r[rrs B rZcfd}|S)z0Decorator for tests that fill the address space.cttkrFtdk\rtdk\rtjdtjdtdz z|S)Nllz-not enough memory: try a 32-bit build insteadr?r@)rr%rxr)rervs r[rz!bigaddrspacetest..wrappersb  &*zU/B''CEE''=%3566T7NrZrY)rvrs` r[rrs  NrZc|SrarY)rs r[_idrIs JrZc|dk(r-ts#tjtjSt |rt Stjdj |S)Nrzresource {0!r} is not enabled)rrxrrrrIrrs r[requires_resourcerKsN5!2!4}}.55668$ }}<CCHMNNrZc&td|S)z9 Decorator for tests only applicable on CPython. T)cpython) impl_detailrs r[rr s %;t $T **rZc tdi|rtS|Nt|\}}|rd}nd}t|j }|j dj |}tj|S)Nz*implementation detail not available on {0}z%implementation detail specific to {0}z or rY) r5rI _parse_guardsrzkeysrrrxr)rbguards guardnamesdefaults r[rNrN&sj"6"  {+F3 G >C9CJOO-. jjZ01 == rZc|sddidfSt|jd}t|j|gt|zk(sJ|| fS)NrMTFr)listvaluesr)rSis_trues r[rQrQ3s[ D!5))6==?#A&G   WIF $; ;; ; K  rZc rt|\}}|jtjj|S)a5This function returns True or False depending on the host platform. Examples: if check_impl_detail(): # only on CPython (default) if check_impl_detail(jython=True): # only on Jython if check_impl_detail(cpython=False): # everywhere except on CPython )rQrrimplementationr)rSrUs r[r5r5=s/$F+OFG ::c((--w 77rZcfttdsStjfd}|S)zEDecorator to temporarily turn off tracing for the duration of a test.gettracectj} tjd|i|tj|S#tj|wxYwra)rr]settrace)rfr<original_tracers r[rzno_tracing..wrapperMsE \\^N - T"T,V, ^, ^,s A A )rrrr)rrs` r[ no_tracingraHs4 3 #   -  -rZc*tt|S)aDecorator for tests which involve reference counting. To start, the decorator does not run the test if is not run by CPython. After that, any trace function is unset during the test to prevent unexpected refcounts caused by the trace function. )rarrOs r[ refcount_testrcXs l4( ))rZc ddl}tj|j d|S#t$rtjd|cYSwxYw)Nrzneeds _testcapi modulezneeds Limited API support)rZrDrxrrELIMITED_API_AVAILABLE)rrZs r[r.r.csa= F8  '')D FFJ LL =6x}}56t<<=s,$AAcVtjtjd|S)Nzrequires specialization)rxrEopcodeENABLE_SPECIALIZATIONrOs r[r/r/ks1 A8  $$&? AAE GGrZcy)z,Just used to check if docstrings are enabledNrYrYrZr[_check_docstringsrjvsrZWITH_DOC_STRINGSztest requires docstringsctjtjjtjtjjyyra)rrr0rrYrZr[flush_std_streamsrms; zz  zz rZcttj}|jD]}t d|||j y)Nz Warning -- r)rm print_warning orig_stderr splitlinesrr0)rbstreamlines r[rorosC  & &F 1 D6"01 LLNrZcttdrttdsytsy tjdtj\}}|dk(ryt d|da?#t $rYywxYw)zUse this function at the end of test_main() whenever sub-processes are started. This will help ensure that no extra children (zombies) stick around to hog resources and create problems when looking for refleaks. waitpidWNOHANGNTrrz%reap_children() reaped child process )rrr"rurvrroenvironment_altered)r*statuss r[r:r:s} B "wr9'= #  **R4KC !8 =cUCD"    s'A)) A54A5c#2Kt||r,t||}t||| |t|||yt||| dt||r t||yy#t|||wxYw#t||r t||wwxYww)aTemporary swap out an attribute with a new object. Usage: with swap_attr(obj, "attr", 5): ... This will set obj.attr to 5 for the duration of the with: block, restoring the old value at the end of the block. If `attr` doesn't exist on `obj`, it will be created and then deleted at the end of the block. The old value (or None if it doesn't exist) will be assigned to the target of the "as" clause, if there is one. N)rrrdelattr)rattrnew_valreal_vals r[r?r?s sD3%T7# )N Cx (T7# # sD!T"" Cx ( sD!T""s3&BA'B A9 B'A66B9BBc#K||vr||}|||< ||||<y|||< d||vr||=yy#|||<wxYw#||vr||=wwxYww)aTemporary swap out an item with a new object. Usage: with swap_item(obj, "item", 5): ... This will set obj["item"] to 5 for the duration of the with: block, restoring the old value at the end of the block. If `item` doesn't exist on `obj`, it will be created and then deleted at the end of the block. The old value (or None if it doesn't exist) will be assigned to the target of the "as" clause, if there is one. NrY)ritemr|r}s r[r<r<sz  s{t9D  !N CID   s{I !CI s{Is+A/ A9 A6A AAc*ddl}|jS)znReturn a list of command-line arguments reproducing the current settings in sys.flags and sys.warnoptions.rN)r1_args_from_interpreter_flagsr1s r[args_from_interpreter_flagsrs  2 2 44rZc*ddl}|jS)zgReturn a list of command-line arguments reproducing the current optimization settings in sys.flags.rN)r1"_optim_args_from_interpreter_flagsrs r[!optim_args_from_interpreter_flagsrs  8 8 ::rZceZdZdZdZdZy)r@)rbmessagec td}|D]0}||}|j|}|j|||r-d}|S|S)a. Try to match a single dict with the supplied arguments. Keys whose values are strings and which are in self._partial_matches will be checked for partial (i.e. substring) matches. You can extend this scheme to (for example) do regular expression matching, etc. TF)r match_value)redr<rrvdvs r[matcheszMatcher.matchessT Aq AqB##Ar1-    rZct|t|k7rd}|St|tus||jvr||k(}|S|j|dk\}|S)zT Try to match a single stored value (dv) with a supplied value (v). Fr)rr_partial_matchesfind)rerrrrs r[rzMatcher.match_value!sc 7d2h F  "XS AT-B-B$B2gF WWQZ1_F rZN)rUrVrWrrrrYrZr[r@r@ s)" rZr@cddl}tLtjdk(r7|j dk(r$t j jdk(rdandatrtjd|S|S) a- Skip decorator for tests that use buggy strptime/strftime If the UCRT bugs are present time.localtime().tm_zone will be an empty string, otherwise we assume the UCRT bugs are fixed See bpo-37552 [Windows] strptime/strftime return invalid results with UCRT version 17763.615 rNr\cp65001r%TFz!buggy MSVC UCRT strptime/strftime) r _buggy_ucrtrr getencodingr localtimetm_zonerxr)rrs r[r*r*/si <<7 """$ 1 ((B.KKGR =8==< =d C\X\\rZcneZdZdZddZej dk(rdZndZdZdZ d Z d d d Z d d d Z y) PythonSymlinkz3Creates a symlink for the current Python executableNcddlm}|xstjj ||_g|_tjjtj|_ g|_ d|_ |jy)Nr)TESTFN)rrrrabspathlink_linkedrealpathrr3real _also_link_env_platform_specific)rerrs r[rdzPythonSymlink.__init__FsY%3BGGOOF3  GG$$S^^4   !rZr\c ddl}ddl}tjj |j r?tjj |j s|jd|_|jtj}tjj|}tjj|j}|jj|tjj|tjj|f|jtjj|j!|dD]Z}|jj|tjj|tjj|f\tj"Dcic]&}|j%tj&|(c}|_tjj|j |j(d<t+j,rt.|j(d<yycc}w)Nrzvcruntime*.dll PYTHONHOME PYTHONPATH)glob_winapirrlexistsrrtGetModuleFileNamer dllhandledirnamerrrrbasenameescaper uppergetenvrr'is_python_buildr)rerrrsrc_dirdest_dirruntimers r[rz PythonSymlink._platform_specificSs  wwtyy)"''..2K$55a8 ++CMM:Cggooc*Gwwtyy1H OO " " Xrww'7'7'<=$  99RWW\\$++g2FHX%YZ &&GGLL277+;+;G+DE(  ;=**EQBIIaL0EDI&(ggoodii&@DIIl #((**4 ,'+Fs+I/cyrarYris r[rz PythonSymlink._platform_specificn rZc.tj|j|j|jj |j|j D]6\}}tj|||jj |8|Sra)rsymlinkrrrrr)rerrs r[ __enter__zPythonSymlink.__enter__qsl 499dii( DII&// &JD$ JJtT " LL   % & rZc|jD]} tj|y#t$r+}trt dj ||Yd}~Kd}~wwxYw)Nzfailed to clean up {}: {})rrremoveIOErrorrrr)reexc_type exc_valueexc_tbrexs r[__exit__zPythonSymlink.__exit__ysVLL HD H $ H H5<t t|dt t|dtjtdj|j|S)Nr)rrr6rrz'unexpected return code: {0} (0x{0:08X})) r1r2PIPE communicate returncoderrreprrr RuntimeErrorr) repythonrfr6rr1cmdpr/s r[_callzPythonSymlink._callsoo   S$.OO  > MMO <<: %d1Q4j!d1Q4jszz29@@NP PrZr)rc>|j|j|d|Sra)rrrerrfs r[ call_realzPythonSymlink.call_realszz$))T4<.s0Fa ||C0AJJt4DFs.0)setdir)ref_api other_apir missing_itemss r[r(r(sPG %C N(;;M V$ F=FFM rZc||jf}nt|tr|f}t|}t |D]l}|j ds||vrt ||}t |dd|vs(t|drAt|tjr\|j|n|j|j|y)a)Assert that the __all__ variable of 'module' contains all public names. The module's public names (its API) are detected automatically based on whether they match the public name convention and were defined in 'module'. The 'name_of_module' argument can specify (as a string or tuple thereof) what module(s) an API could be defined in in order to be detected as a public API. One case for this is when 'module' imports part of its public API from other modules, possibly a C backend (like 'csv' and its '_csv'). The 'extra' argument can be a set of names that wouldn't otherwise be automatically detected as "public", like objects without a proper '__module__' attribute. If provided, it will be added to the automatically detected ones. The 'not_exported' argument can be a set of names that must not be treated as part of the public API even though their names indicate otherwise. Usage: import bar import foo import unittest from test import support class MiscTestCase(unittest.TestCase): def test__all__(self): support.check__all__(self, foo) class OtherTestCase(unittest.TestCase): def test__all__(self): extra = {'BAR_CONST', 'FOO_CONST'} not_exported = {'baz'} # Undocumented name. # bar imports part of its API from _bar. support.check__all__(self, bar, ('bar', '_bar'), extra=extra, not_exported=not_exported) NrorV) rU isinstancerrrrrrtypes ModuleTypeaddassertCountEqual__all__) test_caserename_of_moduleextra not_exportedexpectedrrs r[r)r)sR //, NC ((+5zHF  ??3 4<#7 fd# Ct , >S,/U%5%56 LL v~~x8rZc ddl}|j|j|jz|j z|j zt|drv|j|j|jfD]O}|r9|j||j|j||j>|j|dQyy#t$rYywxYw)NrCrtSetReportMode)msvcrtrD SetErrorModeSEM_FAILCRITICALERRORSSEM_NOALIGNMENTFAULTEXCEPTSEM_NOGPFAULTERRORBOXSEM_NOOPENFILEERRORBOXrCRT_WARN CRT_ERROR CRT_ASSERTrCRTDBG_MODE_FILECrtSetReportFileCRTDBG_FILE_STDERR)rrrs r[suppress_msvcrt_assertsrs 55 ;;< 667!7789 v)*//6#3#3V5F5FG .A''6+B+BC''6+D+DE''1-  .+ sC CCc$eZdZdZdZdZdZdZy)rBzTry to prevent a crash report from popping up. On Windows, don't display the Windows Error Reporting dialog. On UNIX, disable the creation of coredump file. Nc~tjjdr ddl}|j |_|j|j |jzt|drxi|_ |j|j|jfD]K}|j||j}|j!||j"}||f|j|<M|S ddl}||_|j$t |j$j'|j$j(|_|j$j+|j$j(d|j dftjdk(roddl}gd}|j3||j4|j4}|5|j7d} ddd j9d k(rt;d d d |S#t$rYywxYw#t$r d|_Y&wxYw#t,t.f$rYwxYw#1swYgxYw)zOn Windows, disable Windows Error Reporting dialogs using SetErrorMode() and CrtSetReportMode(). On UNIX, try to save the previous core file size limit, then set soft limit to 0. rrNrrr)z/usr/bin/defaultsrzcom.apple.CrashReporter DialogType)rrs developerz:this test triggers the Crash Reporter, that is intentionalr%T)endr0)rrrrrD GetErrorMode old_valuerrr old_modesrrrrrrrr getrlimit RLIMIT_CORE setrlimitrrr1r2rrstripr) rer report_typeold_modeold_filerr1rprocrs r[rzSuppressCrashReport.__enter__s) << " "5 ) $002DN   1M1M M Nv12!#$*OO$*$4$4$*$5$5$7EK &66{"33 5H%66{"55 7H2:H2DDNN;/ET A % ( }}(%)]]%<%\1057tE k  0 % $  %#G, 33sBG8) HA3H9H38 HHHHH0/H03H<c|jytjjdrvddl}|j |j|j rJ|j jD],\}\}}|j|||j||.yy|j< |jj|jj|jyy#ttf$rYywxYw)zARestore Windows ErrorMode or core file behavior to initial value.Nrr)rrrrrrrr{rrrrrrr)re ignore_excrrrrs r[rzSuppressCrashReport.__exit__Gs >> !  << " "5 )     /~~9=9M9M9OC5K!5(H++KB++KBC }}(MM++DMM,E,Et~~V)#G,s0:C,,C>=C>)rUrVrWrXrrrrrYrZr[rBrBs II@DrZrBctd jdfd}|j |t |y#ttf$rtdYEwxYw)zOverride 'object_to_patch'.'attr_name' with 'new_value'. Also, add a cleanup procedure to 'test_instance' to restore 'object_to_patch' value for 'attr_name'. The 'attr_name' should be a valid attribute for 'object_to_patch'. FTNc>rtytyra)rrz) attr_is_local attr_nameobject_to_patchrsr[cleanupzpatch..cleanuprs  OY : OY /rZ)r__dict__rr addCleanupr) test_instancerr new_valuerr rs `` @@r[patchr\sy OY'M#,,Y7  0 W% OY 2 H %>OY= >sA A+*A+c#>K |dd}d||ddy#|ddwxYww)z-Like unittest.mock.patch.dict, but for lists.NrY)origsaveds r[ patch_listr~s)Q Q%Qs c@tddl}|j|S)i Run code in a subinterpreter. Raise unittest.SkipTest if the tracemalloc module is enabled. rN)_check_tracemallocrZrun_in_subinterp)rrZs r[rrs   % %d ++rZ)own_gilc ttddl}|d|vs J||f|rdnd|d<|j|fi|S)rrNgilrr)rrZrun_in_subinterp_with_config)rrrSrZs r[r!r!sP F"5Wf$55"$!u 19 1 1$ A& AArZcv ddl}|jrtjdy#t$rYywxYw)NrzUrun_in_subinterp() cannot be used if tracemalloc module is tracing memory allocations) tracemalloc is_tracingrxrrD)r#s r[rrsI;  ! ! ###%:; ; $    s , 88cGfdd|}d||||jttt|j y)NceZdZfdZy)%check_free_after_iterating..Ac@d ty#t$rYywxYwNT)next StopIteration)redoneits r[__del__z-check_free_after_iterating..A.__del__s&D R   s  N)rUrVrWr.)r,r-sr[Ar's rZr/F) assertRaisesr+r*r assertTrue)riterclsrfr/r,r-s @@r[check_free_after_iteratingr4sFC D ahBmT2.LOODrZcrddlm}m}m}ddlm}|j }|j||jdk(r |j|jD]A}|r||vr t||}|r | Jd|z|s'|j|d<|dcSy#|j$rYywxYw)a<Check if the compiler components used to build the interpreter exist. Check for the existence of the compiler executables whose names are listed in 'cmd_names' or all the compiler executables when 'cmd_names' is empty and return the first missing executable or None when none is found missing. r) ccompilerr'spawn)rpmsvcNz%the '%s' executable is not configured)setuptools._distutilsr6r'r7 setuptoolsrp new_compilercustomize_compiler compiler_type initialize PlatformError executablesrfind_executable) cmd_namesr6r'r7rpcompilerrrs r[rFrFsBA!%%'H I  *'     !$$  Y. h% ? C;dB C?   Q ( 0q6M ##  sB$$B65B6cd}tr;||kr6t(ddl}|jddgj dk(atr|}t j |S)Ngh㈵>rgetpropzro.kernel.qemu1)r2_is_android_emulatorr1 check_outputrrr7)intervalminimum_intervalr1s r[r7r7s`h!11  ' $.$;$; )+;<%>>Ceg%N 'H   **rZc tjd}|S#ttf$r3 tjd}Y|S#ttf$rd}YY|SwxYwwxYw)zGet size of a page in bytes. SC_PAGESIZE SC_PAGE_SIZEi)rsysconfrr) page_sizes r[r8r8soJJ}-   '  >2I N+ I  s&AAAAAAc#Kddl}tjj}|j } |j d|r|j |dyy#|r|j |dwwxYww)NrT)r all_threads) faulthandlerr __stderr__fileno is_enabledrr)rRfdrUs r[disable_faulthandlerrWsu    B((*J;    RT  : :   RT  : s3A<A! A<!A99A<c"eZdZdZdZdZdZy) SaveSignalsz Save and restore signal handlers. This class is only able to save/restore signal handlers registered by the Python signal module: see bpo-13285 for "external" signal handlers. cddl}||_|j|_dD]*} t||}|jj |,i|_y#t$rY@wxYw)Nr)SIGKILLSIGSTOP)signal valid_signalssignalsrrrhandlers)rer]signamesignums r[rdzSaveSignals.__init__sm ++- - (G  1 LL   '  (  "  s A A$#A$c|jD]/}|jj|}|!||j|<1yra)r_r] getsignalr`rerbhandlers r[savezSaveSignals.save%sAll ,Fkk++F3G $+DMM& ! ,rZc|jjD]!\}}|jj||#yra)r`r{r]res r[restorezSaveSignals.restore1s6#}}224 0OFG KK  vw / 0rZN)rUrVrWrXrdrgrirYrZr[rYrYs  ,0rZrYc"ddl}|jSrB)rZ WITH_PYMALLOC)rZs r[ with_pymallocrl6s  " ""rZceZdZdZdZdZy) _ALWAYS_EQz+ Object that is equal to anything. cyr)rYreothers r[__eq__z_ALWAYS_EQ.__eq__?rZcyNFrYrps r[__ne__z_ALWAYS_EQ.__ne__ArZN)rUrVrWrXrrrvrYrZr[rnrn;srZrnc"eZdZdZdZdZdZy) _NEVER_EQz/ Object that is not equal to anything. cyrurYrps r[rrz_NEVER_EQ.__eq__JrwrZcyr)rYrps r[rvz_NEVER_EQ.__ne__LrsrZcy)NrrYris r[__hash__z_NEVER_EQ.__hash__NsrZN)rUrVrWrXrrrvr}rYrZr[ryryFsrZryceZdZdZdZdZy)_LARGESTz? Object that is greater than anything (except itself). c"t|tSra)rrrps r[rrz_LARGEST.__eq__Xs%**rZcyrurYrps r[__lt__z_LARGEST.__lt__ZrwrZN)rUrVrWrXrrrrYrZr[rrSs+rZrceZdZdZdZdZy) _SMALLESTz< Object that is less than anything (except itself). c"t|tSra)rrrps r[rrz_SMALLEST.__eq__ds%++rZcyrurYrps r[__gt__z_SMALLEST.__gt__frwrZN)rUrVrWrXrrrrYrZr[rr_s,rZrc6ddl}|jjS)zDReturn the global event loop policy if one is set, else return None.rN)asyncio.eventsevents_event_loop_policy)asyncios r[maybe_get_event_loop_policyrks >> , ,,rZ) @c~||}}ddl}|j5}|jdz}t|d|_|j |}|dz |z |z}||z} || z } || z } ||dz z|dz |z |zz| d| z zz} t | t | jfcdddS#1swYyxYw)Nrrr)decimal localcontext bit_lengthmaxprecDecimalrsqrt) nbinsnballsrrrctxbitsrwp1empty meanemptyoccupied collisionsvars r[collision_statsrxs &qA$     43||~!tR= __Q Fb=Q&K y=\ "Q$i"Q$Q&a)m)DDZ % "33 4 4 4s BB33B<c(eZdZdZdZdZdZdZy)catch_unraisable_exceptiona Context manager catching unraisable exception using sys.unraisablehook. Storing the exception value (cm.unraisable.exc_value) creates a reference cycle. The reference cycle is broken explicitly when the context manager exits. Storing the object (cm.unraisable.object) can resurrect it if it is set to an object which is being finalized. Exiting the context manager clears the stored object. Usage: with support.catch_unraisable_exception() as cm: # code creating an "unraisable exception" ... # check the unraisable exception: use cm.unraisable ... # cm.unraisable attribute no longer exists at this point # (to break a reference cycle) c d|_d|_yra) unraisable _old_hookris r[rdz#catch_unraisable_exception.__init__srZc||_yra)r)rers r[_hookz catch_unraisable_exception._hooks %rZcZtj|_|jt_|Sra)runraisablehookrrris r[rz$catch_unraisable_exception.__enter__s ++!ZZ rZc2|jt_|`yra)rrrr)reexc_infos r[rz#catch_unraisable_exception.__exit__s!^^ OrZN)rUrVrWrXrdrrrrYrZr[rrs0%  rZrrc tjdk7rddl}|t}t j }t |dD]0}tj|tj\}}|dk7s0n{ tj||jtj|dt j |z }td|d|dd tj|d\}}tj|} | |k7rtd|d | d |d ||k7rtd |d|y#t$rYwxYw)a Wait until process pid completes and check that the process exit code is exitcode. Raise an AssertionError if the process exit code is not equal to exitcode. If the process runs longer than timeout seconds (LONG_TIMEOUT by default), kill the process (if signal.SIGKILL is available) and raise an AssertionError. The timeout feature is not available on Windows. ntrNFerrorzprocess z is still running after .1fz secondsz exited with code z, but exit code z is expectedzpid z != pid )rrr]rNr monotonicsleeping_retryrurvkillr[rAssertionErrorwaitstatus_to_exitcode) r*exitcoderr] start_timeropid2rxdt exitcode2s r[ wait_processrsU ww$ ?"G^^% u5 ykJ..6Z|EF F s{tD6#788#  s56D44 E?Ecddlm}|d|d}tjdk(r |j dyy#t $r}t jd|d}~wwxYw) z Skip tests if the multiprocessing.synchronize module is missing, if there is no available semaphore implementation, or if creating a lock raises an OSError (on Linux only). r) import_module_multiprocessingzmultiprocessing.synchronizelinuxN)rz broken multiprocessing SemLock: ) import_helperrrrLockrrxr)r synchronizeexcs r[*skip_if_broken_multiprocessing_synchronizersv -$% =>K ||w P     &   P##&Fsg$NO O Ps? A%A  A%c|j}|j}|dk7r|d|}n|}dtj|d}|jt ||g|i|y)z Check that given type cannot be instantiated using *args and **kwds. See bpo-43916: Add Py_TPFLAGS_DISALLOW_INSTANTIATION type flag. builtinsrzcannot create 'z ' instancesN)rVrUrrr TypeError)rtprfr modrqualnamerbs r[r+r+sj --C ;;D jU!D6?V BIIh/0 sH**,N. e$  n-n-A!AA!AA!c~|d}n|dkr tdt}t|dz d}||z}t|S)Ni Nz-max_depth must be at least 3, got {max_depth}r)rrrr) max_depthrrs r[r>r>HsO QHII  !E  1 E I E u %%rZrelikec tt}tjdt||dt |dz|S)Nr (?#support))rrer)objectrfilterwarningsDeprecationWarningid)rertokens r[ignore_deprecations_fromrUs< HE #*RYKq11  LrZtokensc|s tdg}td|D}tjD]j\}}}}}|dk(rG|tur?t |t jr |j}n|xsd}|j|rU|j|||||fltj|k7r(|tjddtjyy)Nz.dsDE 2e9+Q/Dsrr%) rrrfiltersrrrPatternr~rr_filters_mutated) r new_filtersractionrrrerrbs r[clear_ignored_deprecationsr_s WXXKDVDDH5=5E5EH166 X (.@"@'2::.oom||H%FGXvvFGH;&)!!#'rZc ddl} ddl}tj |dS#t$rtjddcYSwxYw#t$rd}YHwxYw)NrTzvenv: ensurepip requires zlibzvenv: pip requires ctypes)rCrDrxrrrE)rCrs r[requires_venv_with_piprtscF    v'B CC Ft%DEEF s !AAA AActjdxs$tjj t d}tj |}t|d}|D]L}|jds|dz}|j|s,tjj ||cStd|d|) zTry to find a wheel with the package specified as pkgname. If set, the wheels are searched for in WHEEL_PKG_DIR (see ensurepip). Otherwise, they are searched for in the test directory. WHEEL_PKG_DIR wheeldataT)reversez.whlrz No wheel for z found in ) r'r(rrrrslistdirrzrrr)pkgname wheel_dir filenamesruprefixs r[ _findwheelrs((9RWW\\{>I 9%Iy$/I5  ( 3   v &77<< 84 4 5 mG9JykJ KKrZc #Kddl}ddlm}|5}tjdddd|g}t r%t t dd j||j|d tjj||}tjjtj}tjd k(r"tjj|d |}n!tjj|d|}|dddddtdtdg}t r%t t dd j||j|d |dddy#1swYyxYww)Nrr)temp_cwdz-Xdevz-mvenvzRun: T)rr\Scriptsbinpipinstallr:wheel)r1rrrr3rrrrunrrrrr)venv_dirr1rtemp_dirrr python_exers r[$setup_venv_with_pip_setuptools_wheelr s## x~~tUD&(C  G &#((3- (s$'ww||Hh/WW%%cnn5 <<7 "WW\\$ :>FWW\\$z:FtUUI,''"$  G &#((3- (s$' 5sE?EE3* E?3E<8E?gettotalrefcountc|g}|j|ddl}d}||_|j|t t dr!d}||_t j |yy)an Keep a Python alive as long as possible. Create a reference cycle and store the cycle in an object deleted late in Python finalization. Try to keep the object alive until the very last garbage collection. The function keeps a strong reference by design. It should be called in a subprocess to not mark a test as "leaking a reference". rNcyrarY)encodings r[ search_funcz"late_deletion..search_funcrsrZregister_at_forkcyrarYrYrZr[ atfork_funcz"late_deletion..atfork_funcrrZ)before)rcodecs referenceregisterrrr)r ref_cyclerrrs r[ late_deletionrsb&I Y%K OOK r%&  )  ;/ 'rZrc#K|dkr tdtj}||z} dtj|k\rn|r2tj|z }d|dd}|r|d|}t|yw)a Run the loop body until "break" stops the loop. After *timeout* seconds, raise an AssertionError if *error* is true, or just stop if *error is false. Example: for _ in support.busy_retry(support.SHORT_TIMEOUT): if check(): break Example of error=False usage: for _ in support.busy_retry(support.SHORT_TIMEOUT, error=False): if check(): break else: raise RuntimeError('my custom error') rz!timeout must be greater than zeroNz timeout (rz seconds)r)rrrr)rerr_msgrrdeadlinerrbs r[ busy_retryrs,!|<==!JG#H  >> x '    ^^  *"S+ EG9%CS!!  sA=A?g{Gz?g?) init_delay max_delayrc#K|}t|||D]*}dtj|t|dz|},yw)a Wait strategy that applies exponential backoff. Run the loop body until "break" stops the loop. Sleep at each loop iteration, but not at the first iteration. The sleep delay is doubled at each iteration (up to *max_delay* seconds). See busy_retry() documentation for the parameters usage. Example raising an exception after SHORT_TIMEOUT seconds: for _ in support.sleeping_retry(support.SHORT_TIMEOUT): if check(): break Example of error=False usage: for _ in support.sleeping_retry(support.SHORT_TIMEOUT, error=False): if check(): break else: raise RuntimeError('my custom error') rNr)rrsleepr$)rrrr rdelayros r[rr sD4 E  6*  5EAIy) *s?Ac#Ktj} tj|dtj|y#tj|wxYww)z>Temporarily change the integer string conversion length limit.N)rget_int_max_str_digitsset_int_max_str_digits) max_digitscurrents r[adjust_int_max_str_digitsr)4 sH((*G, "":.  ""7+""7+riiunames390xi ri ii'zskipped on s390xz.git __pycache__c|t}tjj|dk(r |ddhz}|Sd|vr|dhz}|S)NDocbuildrModules) _BASE_COPY_SRC_DIR_IGNORED_NAMESrrr)rnamesignoreds r[copy_python_src_ignorer5_ s].G ww&      N e     NrZra)z requires zlib)z requires gzip)z requires bz2)z requires lzma)z$requires co_positions / debug_ranges)r%)T)NrYrY)F)rY)rXrUrD contextlib dataclassesrrgrrrrr'rrrrxrrrKrLrMrNrrr__file__TEST_SUPPORT_DIRrsr REPO_ROOTrrr rnr rr r&r'rrrrr#junit_xml_listrrr r rrrrrrrrrr,r-HAVE_ASAN_FORK_BUGr8r>r SOCK_MAX_SIZErEr __getformat__rrrrrrrTrVr[rr0r1rr2r6r3r4r r!r"r#r$r%has_strftime_extensionsstrftimer TEST_HTTP_URLrErrrrpr=rCrr|rrrr9contextmanagerrrrrrrrrrrrrrrrrr;rDrrr"_4GrCr%rr rAr(rrrIrKrrNrQr5rarcr.r/rjr(MISSING_C_DOCSTRINGSHAVE_DOCSTRINGSrequires_docstringsrmrorrprwr:r?r<rrr@rr*rrr(r)rrBrrrr!rr4rFrGr7r8rWrYrlrnrGryrHtotal_orderingrrIrrJr hash_infowidth NHASHBITSrrrrr+rrrr>rrrcacherr rOrrrr)rPrQr+machinerrR frozensetr2r5rYrZr[rNs= ~ F GG  ' f  77??277??8#<= 01 WW__] + GGOOJ ' 5I5=J=)E)X&&$     * "K$Z> 76:8: / %UuU@)eEeTY)%T2 $$ % (H'' !,,V4$&--,-1:@llg%  LL # #F + S. / <<++%/!YJJ , ,,& 2v&L}+<LWO+*:7{V '&6w;&+ < <<7 "/$--"6%"? ,    ]F3 &&34V , 1$t 141n  / /%% $  /B$   3 WnG F S=34  ($ 44:F Sj#g#g >3 >3 >   %%B.` $O+ !8  *LG7*+I /I4I445GHH%,,D8,++*h))/*DF JJ #< ##< <5 ;fD ]*OBOBd479 @B 89v.*]]@3D ,37 B ;&+-B +  ;;"$0$0N#  L    ;  *  ;- MM   H 4D))X,0-9^P2 B. .. &S36$$4$* D  LL. F 3* +"0J'"$'"T*#(Ct*D ,,  W ("((*"4"4"?   '   & ! G 4 V9K9Kw9V 24 $-  .$ A9    s.ZZZ