python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_mmap.cpython-311.opt-1.pyc

ezddlmZmZmZmZmZmZddlmZddl	m
Z
mZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZedZejZde
jdZdd	Zerejd
GddejZGd
dejZedkrejdSdS))requires_2G_4G
gc_collectcpython_only
is_emscripten)
import_module)TESTFNunlinkNmmappython_
_test_mmap
cdtjtj|}t
d|S)N)k_)joinrandomchoicesstringascii_uppercasetagname_prefix)lengthsuffixs  B/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_mmap.pyrandom_tagnamers9
WWV^F$:fEEE
F
FF''v'''z.incompatible with Emscripten's mmap emulation.ceZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZejeedddZdZdZ dZ!eje"j#dkdd Z$e%eje"j#dkdd!Z&eje"j#dkdd"Z'eje"j#dkdd#Z(d$Z)d%Z*d&Z+d'Z,d(Z-d)Z.d*Z/d+Z0ejeejd,d-d.Z1eje"j#dkdd/Z2eje"j#dkdd0Z3eje"j#dkdd1Z4eje"j#dkdd2Z5d3Z6d4S)5	MmapTestsctjtrtjtdSdSN)ospathexistsr
rselfs rsetUpzMmapTests.setUp"s8
7>>&!!	If		rc\	tjtdS#t$rYdSwxYwr")r#rr
OSErrorr&s rtearDownzMmapTests.tearDown&s?	If			DD	s
++c
ttd}	|dtz|d|dtdz
z|t
|dtz}|n#|wxYwtt|}|
|dt|
t|dtz|
|dd|
|ddd|
t|jt||
t|jt|dd|d<d	|tdztdzdz<|
|dd|
|ddd
|
|tdz
tdzd
|t#jd|}||dnV|d\}}||z
}|
|t|
|tdz|dd|
|d|dd|
|d|dd|
|t||
t.|jd|
t.|jdd|
t.|jt|dz
d	|d|
t|d|
t.|jddttd}	|dd|
|d|n#|wxYw|
|dn#t4$rYnwxYw|dS)Nzbw+foors3bars3sfoobars	[A-Za-z]+zregex match on mmap failed!*rb)openr
writePAGESIZEflushrfilenoclosestrtypeassertEqualfindlenassertRaises
IndexError__getitem____setitem__researchfailspanseektell
ValueErrorresizesizeSystemError)r'fmtpmatchstartendrs        r
test_basiczMmapTests.test_basic,s
	
GGE8O$$$
GGFOOO
GGEHQJ')))
GGIII		!((**a(l33A
GGIIIIAGGIIIIa\\222Q8,,,1q!!!1Q3+++	
*amSVV<<<*amSVVUCCC!(.(A+x{1}
$%	
1w'''1Q3***8A:145}EEE					,**=II34444AJE35[FUH---S(Q,///	
q1%%%	r!2&&&	q3q66***	
*afb111	
*afa333	
*afs1vvgai;;;	,
HHSMMM
SVVS)))j!&#q999VT""A
q!  3///								QVVXXs++++'			
D		*	
					s*BCCU
8>TT!
UUc
d}ttd5}|d|zdddn#1swxYwYttd5}t||tj}||ddd|zd	d|z|dd<|dn#t$rYnwxYw	d|d	<|dn#t$rYnwxYw	|	d	d	|d
|dn#t$rYnwxYw	|	d	d	|
d|dn#t$rYnwxYw	|d|z|d
n#t$rYnt$rYnwxYwttd5}||
d|zddddn#1swxYwYdddn#1swxYwYttd5}	t||dz}tjds|d|nD#t$$r7tjdr|dYnwxYwtjdrBttd5}||dddn#1swxYwYdddn#1swxYwYttd5}t||tj}d|z|dd<||ddd|zd||dddn#1swxYwYttd5}|
}dddn#1swxYwY||d|zdttd5}t||tj}d|z|dd<||ddd|zd|ttd5}||
d|zddddn#1swxYwY|t|jd|z|dddn#1swxYwYttd5}|t$tj||ddddn#1swxYwYt0jdkrrttd5}|t$tj||tjtjtjdddn#1swxYwYtjt9tdd	z}ttd5}	t|||}|t|jd|t|j
d	|n#t:$rYnwxYwddddS#1swxYwYdSdS)Nrwbar:accessz#Readonly memory map data incorrect.bz$Able to write to readonly memory maprabcdr0z"Able to resize readonly memory mapz*Readonly memory map data file was modifiedr+br3winz1Opening mmap with size+1 should raise ValueError.z0Opening mmap with size+1 should work on Windows.cz5Write-through memory map memory not updated properly.z8Write-through memory map data file not updated properly.z4Copy-on-write memory map data not written correctly.z4Copy-on-write test data file should not be modified.posix)flagsprotr_	PROT_EXECrisabcdef)r;r
r<rr?ACCESS_READrCrL	TypeErrorrN
write_byterQrSreadsysplatform
startswithr@rPtruncateACCESS_WRITEr>ACCESS_COPYrFr#nameMAP_PRIVATE	PROT_READgetattrPermissionError)r'mapsizefprTrUstuffris       rtest_access_parameterzMmapTests.test_access_parameters

&$

	#2HHT'\"""	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#
&$

1	O1		!((**gd6F	GGAQqqqT4<1VWWW
BG|!!!		@AAAA




B!		@AAAA




Bq		@AAAA




BqT"""		@AAAA




@7###		>????






fd##
Or  DL!MOOO
O
O
O
O
O
O
O
O
O
O
O
O
O
O
O_1	O1	O1	O1	O1	O1	O1	O1	O1	O1	O1	O1	O1	O1	O1	Oh&%
 
 	(A

IIahhjj'!)44|..u55SIIQRRR				
R
R
R
<**511RIIPQQQ

R|&&u--
(&%(((AJJw'''(((((((((((((((#	(	(	(	(	(	(	(	(	(	(	(	(	(	(	(*&%
 
 	A		!((**gd6G	HHA<AaaaDQqqqT4<J
L
L
L
GGIII
GGIII															&$

	1FFHHE															WI	K	K	K&%
 
 	A		!((**gd6F	GGA<AaaaDQqqqT4'>S
U
U
U
GGIIIfd##
Yr  DL!WYYY
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
i1W9===
GGIII															&%
 
 	TAj$)QXXZZQRSSS	T	T	T	T	T	T	T	T	T	T	T	T	T	T	T7gfe$$
Q!!*diW(,(8'+~d>O"QQQ
Q
Q
Q
Q
Q
Q
Q
Q
Q
Q
Q
Q
Q
Q
Q>GD+q$A$AADfe$$	
		!((**gD	AAA
%%i)DDD%%iqAAAGGIIII
'D	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
s=AAAI):
CI)
C'$I)&C''I)+D0I)
DI)DI)+EI)
E%"I)$E%%I))+F*I)*
F74I)6F77I);G)I))
H3I)5	H>I)HI)-II)I	I)I	I))I-0I-	N50L;A	N5>MN5M7N5<NN5N"	"N5%N"	&N55N9<N9BQ//Q36Q3R00R47R4*BX9-V2&X2V6	6X9V6	:;XXX!<Y))Y-0Y-A\\	\_*/_
6A_*
__*__**_.1_.cT|ttjdddS)N)rFr*rr&s rtest_bad_file_desczMmapTests.test_bad_file_descs$'49b$77777rcttd5}d}t|}|||t
||}dddn#1swxYwYt|dzD]}t||dzD]t}|||}||	||	|||	|dzdu|
dS)Nwb+saabaacdeefaar3xr7)r;r
rEr<r>rr?rangerCrDr@)r'rTdatanrUrXfinishslices        rtest_tougher_findzMmapTests.test_tougher_finds`&%
 
 	)A2DD		A
GGDMMM
GGIII		!((**a((A
	)	)	)	)	)	)	)	)	)	)	)	)	)	)	)1Q3ZZ	;	;Eqs++
;
;UV^,  		%0@0@AAA  !5!5r::::
;	
					A(B

BBc
ttd5}d}t|}|||t
||}dddn#1swxYwY||dd||dd||dddd||ddd||dddd||ddd	d||tddt|dz
|dzD]g}t|dz
|dzD]M}d
D]H}||||}|||||||||fINhdS)Nrone two onesoneronesr7r3r)osonstwors)r;r
rEr<r>rr?rCrD	bytearrayr)	r'rTrrrUijpexpecteds	         r
test_find_endzMmapTests.test_find_end"sd
&%
 
 	)A"DD		A
GGDMMM
GGIII		!((**a((A	)	)	)	)	)	)	)	)	)	)	)	)	)	)	)	
+++!,,,2..222**A...2..2222..333	& 1 122A666r!tQqS!!	K	KAA2a41%%
K
K=KKA#yyAq11H$$QVVAq!__hAq	JJJJK
K	K	Krc	tjtjz}tj}d}tj}n'#t
$r}t
jd|d}~wwxYwtddD]}td||dzz||5}td||dzz||5}|	dd	dddn#1swxYwYdddn#1swxYwYdS)
Nrzmmap flags unavailableir7r3)rhriisfor)
rrw
MAP_ANONYMOUSr=rxAttributeErrorunittestSkipTestrrD)	r'rhr=	PROT_NONErxerguardfms	         r'test_find_does_not_access_beyond_bufferz1MmapTests.test_find_does_not_access_beyond_buffer9s	E$t'99E}HIII	E	E	E#$<==1D	Eq$	'	'A2x1q51!&Y88
';@YYr8q4x#8%*<<'?AGGE2&&&'''''''''''''''
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'	'	'sK36
AAA%C28CC2CC2"C#C22C6	9C6	cttd5}d}t|}|||t
||}dddn#1swxYwY||dd||dd||dddd||dddd||dd	dd||dd	dd||tdddS)
Nrrrrsone rr7rr3)
r;r
rEr<r>rr?rCrfindr)r'rTrrrUs     r
test_rfindzMmapTests.test_rfindIs
&%
 
 	)A"DD		A
GGDMMM
GGIII		!((**a((A	)	)	)	)	)	)	)	)	)	)	)	)	)	)	)	
!,,,))1---B//333B//333B//333B//4446!2!233Q77777rcttd5}|ddzdddn#1swxYwYttd5}t|dtj}||ddddS#1swxYwYdS)Nrr]r:r^)r;r
r<rr?rlr@r'rTmfs   rtest_double_closezMmapTests.test_double_close[s)
&%
 
 	"A
GGEDL!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"&$

	1188::uT5EFFBHHJJJHHJJJ																		s ;??A"C

CCcttd5}|ddzdddn#1swxYwYttd5}t|d5}|t
|dd||dddzdddn#1swxYwYddddS#1swxYwYdS)Nrrmzrb+rz Map size should equal file size.)r;r
r<rr?rCrErors   rtest_entire_filezMmapTests.test_entire_filees
&%
 
 	"A
GGEDL!!!	"	"	"	"	"	"	"	"	"	"	"	"	"	"	"&%
 
 	;A
YYqxxzz1
%
%	;)+SWWe-OPPPRWWU^^UT\:::	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;	;sD;??.C>	AC&C>&C*	*C>-C*	.C>>DDcttd5}|ddzdddn#1swxYwYttd5}t|ddtj5}|t|jddddn#1swxYwYddddS#1swxYwYdS)	Nr\irr:rroffsetr_i8)	r;r
r<rr?rlrFrGrHrs   rtest_length_0_offsetzMmapTests.test_length_0_offsetos
&$

	(1
GGY$&'''	(	(	(	(	(	(	(	(	(	(	(	(	(	(	(&$

	E1188::qt?OPP
ETV!!*bneDDD
E
E
E
E
E
E
E
E
E
E
E
E
E
E
E	E	E	E	E	E	E	E	E	E	E	E	E	E	E	E	E	E	EsC;??;C"C8CC	CC	CC #C cbttd5}|ddzdddn#1swxYwYttd5}|tt
j|ddddddS#1swxYwYdS)Nr\irw+brir)r;r
r<rFrPrr?r'rTs  rtest_length_0_large_offsetz$MmapTests.test_length_0_large_offset{s!&$

	#1
GGFTM"""	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#&%
 
 	1Aj$)QXXZZ%/

1
1
1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1s;??<B$$B(+B(c	pttd5}|d|t|d}|ddd||dddd|dddn#1swxYwYd}tt|D]}tt|D]}tt|t||z
D]}|d|||||zz|||zdz}td	t|}||dd<||||||dd||ьtd	d
}gd}	tj
|	|	|	D].\}
}}	||
||#t$rY+wxYwgd}	|	D])\}
}}|t|j|
||*|td	d
}|t|jddd|t|jd
dd
|t|jdd
d
|ddd
|ddddS)Nrs
ABCDEabcderrs
ABCDEABCDEz'Map move should have duplicated front 5
0123456789r7d)ir7rr3r))r7r7r7)r7r7r)r7rr7)rr7r7)r7rr)rr7r)rrr7r3r0)r;r
r<r>rr?moverCr@rrEmax	itertoolsproductrPrF)r'rTrrdestsrccountrrUoffsetssourcerRs            r	test_movezMmapTests.test_movesb
&%
 
 	A
GGM"""
GGIII188::r**BGGAq!RUM3\]]]HHJJJ															#d))$$		DSYY''

"3t99s4~~#=>>E#ETE{T#c%i--@@4U
CTTH		"c$ii00AAaaaDFF4e,,,$$QqqqT8444GGIIII


IIb#'''"+"3GWg"N"N		FD$
vtT****



777")	F	FFD$j!&&$EEEE				IIb!*afaA666*afaA666*afaA666	q!Q	q!Qs$B!CC
CH00
H=<H=c(tdt}ttD]}|||dd ttD](}|dz}|||<||||)dS)Nr7rz+anonymously mmap'ed contents should be zero)rr=rrC)r'rUxbs    rtest_anonymouszMmapTests.test_anonymoussIIb(##x	L	LAQqT1J
L
L
L
Lx	&	&ADAAaDQqT1%%%%	&	&rc	ntdd}||j|t	td|d||t	td|d||t	tdd|d||d|d||dt	tdd|d||dt	tdd|d||d	t	tdd|d
||dt	td
ddS)Nr7rrrr/rfrr	i)	r
addCleanupr@r<bytesrrNrCror'rUs  r
test_read_allzMmapTests.test_read_allsIIb"   	
eBii  !!!	q			5r#3#3444	q			5q"#6#6777	r


3'''	q			uU1b\\':':;;;	q			U5B<<%8%8999	q			U5B<<%8%8999	q			eE!RLL&9&9:::::rc:tdd}||j|t|jd|t|jd|t|jgddS)Nr7rfoog@)r3r0r/)rrr@rFrmrors  rtest_read_invalid_argzMmapTests.test_read_invalid_argsIIb"   )QVU333)QVS111)QVYYY77777rctttd}tdt	|}||dd<||dd|ddddddtjddd	d
f}|D]<}|D]7}|ddD]*}|||||||||+8=dSNr7rr3r/i,rii)rreversedrrrErCrpmaxsize)r'srUindicesrXstopsteps       rtest_extended_getslicez MmapTests.test_extended_getslices(5::&&''IIb#a&&!!!!!111q!!!dAq"c3;BTJ	9	9E
9
9#ABBK99D$$QuT$%7%&uT$%799999
9	9	9rc0tttd}tdt	|}ddddddt
jddd	d
f}|D]}|D]}|ddD]}||dd<||dd|t|}||||}tt|}|||||<|||||<||ddt|dSr)	rrrrrErprrClist)	r'rrUrrXrrLrs	         rtest_extended_set_del_slicez%MmapTests.test_extended_set_del_slices?(5::&&''IIb#a&&!!dAq"c3;BTJ
	5
	5E
5
5#ABBK
5
5DAaaaD$$QqqqT1---QAU4_-D $00D)-AeDo&)-AeDo&$$QqqqT5884444
5
5
	5
	5rc|d|z|d|d|dz
z|t|dS)Nr-r.r/r)r<r>rr?)r'rThalfsizes   rmake_mmap_filezMmapTests.make_mmap_fileso	!"""		(Q,'(((	


yy!((**a(((rc	@ttd}|ttd5}|tdt
j|dt
jddddS#1swxYwYdS)Nrr:zcannot mmap an empty filerr^)r;r
r@assertRaisesRegexrPrr?rlrs  rtest_empty_filezMmapTests.test_empty_files&%  				
&$

	<1"":#>#'9ahhjj!*.*:
#
<
<
<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<	<sABBBczttd}	tj}|||}|||dz}ttd}dD]{}	t|||}|dd|dd_#tttf$rYxwxYw|ttd}t|||z
|}||ddd	|	|d
|t|d
|
t|jdd||ddd	ttd}|dd|||d
z||||d
zn#t"$rYnwxYw||	t%jtdS#t($rYdSwxYw#|	t%jtw#t($rYwwxYwxYw)
Nrr0rc)rr7Nrrr3r/r.r8r9r:)r;r
rALLOCATIONGRANULARITYrr@r?rCrPrm
OverflowErrorrQrErFrNrOrRrSr#rr*)r'rTrrUr{rs      rtest_offsetzMmapTests.test_offsets&%  4	1H##Q11A
GGJJJ
GGJJJlGVU##A(
+
++		!((**gf	EEA$$Q***$$Q****#I}=D
GGIIIVU##A		!((**g&8	JJAQqsVV,,,
GGIII
;


  Q---!!*afc1===  1Q3000&&q!  8c>:::			  8c>::::



"
GGIII
GGIII
	&!!!!!




GGIII
	&!!!!



sA(K:ACK:C63K:5C66BK:JC9K:
J"K:!J""K:K))
K76K7:L:L*)L:*
L74L:6L77L:cVGddtj}|tdS)NceZdZdZdS)*MmapTests.test_subclass.<locals>.anon_mmapc8tjj|dg|Ri|S)Nr7)r__new__)klassargskwargss   rrz2MmapTests.test_subclass.<locals>.anon_mmap.__new__Ks'y(DTDDDVDDDrN)__name__
__module____qualname__rrr	anon_mmaprJs(
E
E
E
E
Err)rr=)r'rs  r
test_subclasszMmapTests.test_subclassIsN	E	E	E	E	E		E	E	E		(rrxzneeds mmap.PROT_READcd}ttd5}|d|zdddn#1swxYwYttd5}t||tj}|t|jdddddS#1swxYwYdS)Nrr\r]r:rkr)r;r
r<rr?rxrFrm)r'r{r|rTrUs     rtest_prot_readonlyzMmapTests.test_prot_readonlyOs+
&$

	#2HHT'\"""	#	#	#	#	#	#	#	#	#	#	#	#	#	#	#
&$

	91		!((**gDN	CCAi%888	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9	9s"=AAACC	C	cP|tjtdSr")assertIsrerrorr*r&s r
test_errorzMmapTests.test_errorXs

dj'*****rc|d}ttd5}|dt|zdddn#1swxYwYttd5}t|t|}dddn#1swxYwYt
t|D]p}||||	|||||dzq|
t|j	d||dd||dt
t|D]}|||||
|||||dz|
t|j
|d||dd	||d
|d|d||d
||ddd|td
||d||ddd|
t|jddS)Nrr\rrcr3xrr/s345r5r2s
012bar6789sbazrs
012barbaz9sba)r;r
r<rErr?rrCrOrnrFrPrN	read_byteror)r'rr|rTrUrs      rtest_io_methodszMmapTests.test_io_methods[s~
&$

	%2HHT#d))^$$$	%	%	%	%	%	%	%	%	%	%	%	%	%	%	%
&%
 
 	1A		!((**c$ii00A	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1s4yy!!	,	,AQVVXXq)))
LLa!!!QVVXXqs++++*alG<<<111t$$$	q			s4yy!!	,	,AQVVXXq)))Q[[]]DG444QVVXXqs++++*ak222	q			F+++1%%%	q				1%%%111}---		&!!"""1%%%111}---*agu55555s#&A

AA*;B11B58B5cJdD]}tdd}||||d||d||||dS)N)rr7r3r)rrnrCrNrr@)r'rrUs   rtest_non_ascii_bytezMmapTests.test_non_ascii_byte}s 		A		"a  A
LLOOOQqT1%%%
FF1IIIQ[[]]A...
GGIIII
		rntzrequires Windowsc^d}d}t}t}tdt||}||dd<tdt||}||dd<||dd|||dd|||tdt||}||dd<tdt||}||dd<||dd|||dd|||dS)Nrs
abcdefghijr7tagname)rrrErCr@)r'data1data2tagname1tagname2m1m2s       rtest_tagnamezMmapTests.test_tagnames~!##!##YYr3u::xY
8
8111
YYr3u::xY
8
8111AAA&&&AAA&&&







YYr3u::xY
8
8111
YYr3u::xY
8
8111AAA&&&AAA&&&









rc,tdd}t}tdd|}|tj|tj|t|zdzdS)Nr7rrr3)rrrCrp	getsizeofrE)r'rr
rs    rtest_sizeofzMmapTests.test_sizeofsYYr3

 ""
YYr3Y
0
0r**r**S\\9A=	?	?	?	?	?rct}tdd|}	tdd|ddn#YnxYw|ttd5}|ddddn#1swxYwYttd}t|d}|	|dn#YnxYw	|ddn#YnxYw|dS)	Nr7rr\s
xxxxxxxxxxrcr)rrr@r;r
r<r?rQ)r'r
rUr|rTs     rtest_crasher_on_windowsz!MmapTests.test_crasher_on_windowssn!""IIb$I00	IIb$I00333	D				&$

	2HHW															IIahhjj!$$					
HHQKKKK	D	
aaaDDD	D						s5%AAB%%B),B)DD!%
D00D4cFtj}	|t5t|d}dddn#1swxYwY|dS#|wxYwNr)socketrFr*rr?r@)r'rrUs   rtest_invalid_descriptorz!MmapTests.test_invalid_descriptors

MOO	""7++
.
.IIahhjj"--
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
GGIIIIIAGGIIIIs.B
.A)B
)A--B
0A-1B

B ctdd5}||jdddn#1swxYwY||jdS)Nr7r)rassertFalseclosed
assertTruers  rtest_context_managerzMmapTests.test_context_managers
YYr2

	'!QX&&&	'	'	'	'	'	'	'	'	'	'	'	'	'	'	'!!!!!sAA
Ac@|t5}tdd5}t#1swxYwY	dddn#1swxYwY||jtd||jddS)Nr7rz)wrong exception raised in context managerzcontext manager failed)rF	Exceptionrr*assertIsInstance	exceptionr#r")r'excrUs   rtest_context_manager_exceptionz(MmapTests.test_context_manager_exceptions


y
)
)	S2r""
a









																
cmWI	K	K	K":;;;;;s,A?A	AA	AAActdd}tj|}|||~t	||ddS)Nr7r)rweakrefrefrr)r'mmwrs   rtest_weakrefzMmapTests.test_weakrefsh
YYr2


[__

bbddB

bbddD!!!!!rctdd}||dd||dd||dd||d	d
dS)Nr7rrrrr3syzr0pythonr5)rrCr<)r'r.s  r0test_write_returning_the_number_of_bytes_writtenz:MmapTests.test_write_returning_the_number_of_bytes_writtens
YYr2

#***$+++%!,,,),,a00000rc(tdd}||j|d	|dn%#t
$r|dYnwxYw||dd|t|j
|t|jd|t|jd	dS)
Nr7i rrzresizing not supportedrr6ra)
rrr@rorQrSskipTestrCrFrPrrnr<rs  rtest_resize_past_poszMmapTests.test_resize_past_possIIb$   	t	4
HHTNNNN	4	4	4MM233333	4S)))*ak222*alB777*agv66666sA""BBctdd}|t5||zdddn#1swxYwY|t5|dzddddS#1swxYwYdS)Nr7rr0)rrFrmrs  rtest_concat_repeat_exceptionz&MmapTests.test_concat_repeat_exceptionsIIb"


y
)
)		
EE															


y
)
)		
EE																		s#AAA-BBBctdd}||j|d|}||tjdr1|	t|jdtddSdS)Nr7rr2linuxr3)rrr@r<r>assertIsNonerprqrrrFr*rE)r'r.results   rtest_flush_return_valuez!MmapTests.test_flush_return_valuesYYr2

!!!
&!!!<""7++	D
grxC	NNCCCCC	D	Drc
0tjd}tjd}d}td|D}t||D]@\}}d|z}||z
}d}	d|dz|d	z|d
zf}
t	t
d5}|||tj	|	|
D]\}}
tt|}t||||5}|
|
|t|}||||d
|||dt'|||dt'|
||dt'|dddn#1swxYwY|t|}||	dddn#1swxYwYBdS)Nzr<mmap.mmap closed=False, access=(?P<access>\S+), length=(?P<length>\d+), pos=(?P<pos>\d+), offset=(?P<offset>\d+)>z<mmap.mmap closed=True>)2rri@Bic3TK|]#}|dztjztjzV$dS)r0N)rr).0r{s  r	<genexpr>z&MmapTests.test_repr.<locals>.<genexpr>sUNN9@!A)CC45NNNNNNrr])ACCESS_DEFAULTrlrurtrrrrfr)r_rr_rposr)rJcompiletuplezipr;r
r<r>rrryrr?rNrWreprassertIsNotNonerCgrouprA)r'open_mmap_repr_patclosed_mmap_repr_patmapsizesrrr{rraccesses	positionsr|r_rEaccintr.rWs                 r	test_reprzMmapTests.test_reprs
Z
'(( "z*DEE:NNDLNNNNN"7H55	0	0OFG'>Dv%F7HFBJ	619=Ife$$
0


#,#4Xy#I#I00KFC$T622F299;;#)*0*0#22
M68 2 8 8b B B,,U333((X)>)>GGG((X)>)>FLLL((U););SXXFFF((X)>)>FLLL
M
M
M
M
M
M
M
M
M
M
M
M
M
M
M166tBxx@@E((////0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
	0	0s8
B
J	DH8	,J	8H<
<J	?H<
<J		J
	J
	madvisez
needs madvisec*dtz}td|}|td5|tj|dddn#1swxYwY|td5|tjddddn#1swxYwY|td5|tjdddddn#1swxYwY|td5|tjttjdddn#1swxYwY|	|tjd|	|tjtd|	|tjt|d|	|tjddd|	|tjd|ddS)Nr0r7zmadvise start out of boundszmadvise length invalidrzmadvise length too large)
r=rrrPrSMADV_NORMALrrprrC)r'rRrUs   rtest_madvisezMmapTests.test_madvise5s8|IIb$

#
#J0M
N
N	.	.
IId&---	.	.	.	.	.	.	.	.	.	.	.	.	.	.	.

#
#J0M
N
N	,	,
IId&+++	,	,	,	,	,	,	,	,	,	,	,	,	,	,	,

#
#J0H
I
I	/	/
IId&2...	/	/	/	/	/	/	/	/	/	/	/	/	/	/	/

#
#M3M
N
N	?	?
IId&#+>>>	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?4#344d;;;4#3X>>EEE4#3XtDDdKKK4#3Q::DAAA4#3Q==tDDDDDsH!A..A25A2!CCC'"DDD;1E88E<?E<cjt}d|z}tdt|D}td|}||dd<|||t
||||d||d|dS)zIf the mmap is backed by the pagefile ensure a resize up can happen
        and that the original data is still in place
        r0c3>K|]}tjdVdSrNrgetrandbitsrBrs  rrCzCMmapTests.test_resize_up_when_mapped_to_pagefile.<locals>.<genexpr>O-FFqV'**FFFFFFrr7Nr=rrrrQrCrEr'
start_sizenew_sizerrUs     r&test_resize_up_when_mapped_to_pagefilez0MmapTests.test_resize_up_when_mapped_to_pagefileHs

z>FFE*4E4EFFFFFIIb*%%!!!	Q***;J;kzk):;;;;;rcjt}|dz}tdt|D}td|}||dd<|||t
||||d||d|dS)zIf the mmap is backed by the pagefile ensure a resize down up can happen
        and that a truncated form of the original data is still in place
        r0c3>K|]}tjdVdSrYrZr\s  rrCzEMmapTests.test_resize_down_when_mapped_to_pagefile.<locals>.<genexpr>^r]rr7Nr^r_s     r(test_resize_down_when_mapped_to_pagefilez2MmapTests.test_resize_down_when_mapped_to_pagefileWs

?FFE*4E4EFFFFFIIb*%%!!!	Q***9H9tIXI77777rcdtz}t}ttd}||	t||}t||}|t5||dddn#1swxYwY|t5||dddn#1swxYwY|	|||
|||
tj
|j||	dS#|	wxYw)zqIf more than one mapping is held against a named file on Windows, neither
        mapping can be resized
        r0rN)r=r;r
rsrr?rFr*rQr@rCrRr#statst_size)r'r`reduced_sizerTrrs      r+test_resize_fails_if_mapping_held_elsewherez5MmapTests.test_resize_fails_if_mapping_held_elsewherefs
\
	

:	188::z22B188::z22B""7++
(
(		,'''
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(""7++
(
(		,'''
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(HHJJJIIl###RWWYY555RWQXXZZ008,GGG
GGIIIIIAGGIIIIsUA4G1CGCGCG8DGDG!D"BGG!cdtz}t}t}d}tdt|D}td||}td||}||d|<||d|||t5||dddn#1swxYwY||	|||d||||d||dS)zIf a more than one mapping exists of the same name, none of them can
        be resized: they'll raise an Exception and leave the original mapping intact
        r0rc3>K|]}tjdVdSrYrZr\s  rrCzUMmapTests.test_resize_succeeds_with_error_for_second_named_mapping.<locals>.<genexpr>s-GGqV'**GGGGGGrr7rN)
r=rrrrrCrFr*rQrR)r'r`rir
data_lengthrrrs        r8test_resize_succeeds_with_error_for_second_named_mappingzBMmapTests.test_resize_succeeds_with_error_for_second_named_mapping~s~
\
!##GGE+4F4FGGGGG
YYr:wY
7
7
YYr:wY
7
7<K<L[L)4000


w
'
'	$	$IIl###	$	$	$	$	$	$	$	$	$	$	$	$	$	$	$J///L[L)4000L[L)400000sC##C'*C'c	b
Gdd}tjtjtjtjg}tjtjtjg}|D]}||5\}}|td5||dddn#1swxYwYdddn#1swxYwY||5\}}|td5||ddddn#1swxYwYdddn#1swxYwY||5\}}|td5||dddddn#1swxYwYdddn#1swxYwY||5\}}|td5|d|ddddn#1swxYwYdddn#1swxYwY||5\}}|td5||dddn#1swxYwYdddn#1swxYwY||5\}}|td5|dd	|dddn#1swxYwYdddn#1swxYwY|D]+}||5\}}|td5d
||d<dddn#1swxYwYdddn#1swxYwY||5\}}|td5d||dd<dddn#1swxYwYdddn#1swxYwY||5\}}|td5d|d|d<dddn#1swxYwYdddn#1swxYwY||5\}}|td5|	d	d|dddn#1swxYwYdddn#1swxYwY||5\}}|td5|
|dddn#1swxYwYdddn#1swxYwY-dS)zj
        gh-103987: Test that mmap objects raise ValueError
                for closed mmap files
        c"eZdZddZdZdZdS)KMmapTests.test_mmap_closed_by_int_scenarios.<locals>.MmapClosedByIntContextreturnNc||_dSr"r^)r'r_s  r__init__zTMmapTests.test_mmap_closed_by_int_scenarios.<locals>.MmapClosedByIntContext.__init__s
$rcZttd|_|jt	jd|jt|jd|j	Gfdd}|fS)Nrrr^ceZdZfdZdS)`MmapTests.test_mmap_closed_by_int_scenarios.<locals>.MmapClosedByIntContext.__enter__.<locals>.Xc0dSr)r@rs r	__index__zjMmapTests.test_mmap_closed_by_int_scenarios.<locals>.MmapClosedByIntContext.__enter__.<locals>.X.__index__s			!rrN)rrrry)rUsrXrws."""""""rrz)
r;r
rTr<r	randbytesr>rr?r_)r'rzrUs  @r	__enter__zUMmapTests.test_mmap_closed_by_int_scenarios.<locals>.MmapClosedByIntContext.__enter__sfe,,V-c22333IIdfmmoos4;IGG""""""""""
1v
rc8|jdSr")rTr@)r'exc_type	exc_value	tracebacks    r__exit__zTMmapTests.test_mmap_closed_by_int_scenarios.<locals>.MmapClosedByIntContext.__exit__sr)rrN)rrrrtr|rrrrMmapClosedByIntContextrqsF
%
%
%
%







rrzmmap closed or invalidNr0r1r3s
1111111111s11111)rrlrtrurDrrProrDrrn)r'rread_access_modeswrite_access_modesr_rUrzs       r!test_mmap_closed_by_int_scenariosz+MmapTests.test_mmap_closed_by_int_scenarioss
								,
	


(	)	)F''//
6Aq++J8PQQaaccFF














('//
 6Aq++J8PQQ  aaccBhKK               
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 ('//
$6Aq++J8PQQ$$aaccBlOO$$$$$$$$$$$$$$$
$
$
$
$
$
$
$
$
$
$
$
$
$
$
$('//
%6Aq++J8PQQ%%b1133m$$%%%%%%%%%%%%%%%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%('//
 6Aq++J8PQQ  FF1133KKK               
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 ('//
)6Aq++J8PQQ))FF4AACC((()))))))))))))))
)
)
)
)
)
)
)
)
)
)
)
)
)
)
))	&	&F''//
,6Aq++J8PQQ,,"+AaaccBhK,,,,,,,,,,,,,,,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,('//
/6Aq++J8PQQ//&.AaaccBlO///////////////
/
/
/
/
/
/
/
/
/
/
/
/
/
/
/('//
06Aq++J8PQQ00'/Ab1133m$000000000000000
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0('//
&6Aq++J8PQQ&&FF1a%%%&&&&&&&&&&&&&&&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&('//
&6Aq++J8PQQ&&LL%%%&&&&&&&&&&&&&&&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&#	&	&sR/CB+C+B//C2B/3CC		C	D-7D
D-DD-DD--D1	4D1	F"F6FFF	F
FF	 F	/HG."H.G22H5G26HH		H		I;:I$I;$I((I;+I(,I;;I?	I?	K30 KK3K  K3#K $K33K7	:K7	M"/M?M"MM"MM""M&	)M&	8ON4(O4N88O;N8<OO	O	!P4PP4P!!P4$P!%P44P8	;P8	
R,) R	R,RR,RR,,R0	3R0	T"!T?T"TT"TT""T&	)T&	N)7rrrr(r+rZr~rrrrrrrrrrrrrrrrrrrr
skipUnlesshasattrrrrrr	r#rvrrrrrr$r*r0r3r7r9r>rRrVrbrerjrnrrrrr r  sK\\\|@@@D888$KKK.
'
'
' 888$;;;
E
E
E111---^
&
&
&;;;*888999555()))<<<777rX{335KLL99ML9+++ 6 6 6DXD*<==>=6XD*<==??>=\?XD*<==>=4XD*<==		>=	"""
<<<"""111777DDD"0"0"0HXI66HHEEIHE$XD*<==<<>=<XD*<==88>=8XD*<==>=.XD*<==11>=1(T&T&T&T&T&rr ceZdZdZdZdZdZdZdZe	j
eje
kddZe	j
eje
kdd	Zd
S)LargeMmapTestsc.ttdSr"rr
r&s rr(zLargeMmapTests.setUpvrc.ttdSr"rr&s rr+zLargeMmapTests.tearDownrrctjdddkstjdkr tddtdzt	t
d}	|||||n\#tttf$rB	|n#ttf$rYnwxYwtjdwxYw|S)	Nr/rddarwin	largefilez-test requires %s bytes and a long time to runrz*filesystem does not have largefile support)rprqrrAr;r
rNr<r>r*rrPr@rr)r'
num_zeroestailrTs    r_make_test_filezLargeMmapTests._make_test_files<u$$(@(@[?#kBRBRR
T
T
T		R
FF:
GGDMMM
GGIIII
3	R	R	R
				]+



#$PQQQ	Rs0>BC76C
C7CC7CC7c@|dd5}t|ddtj5}||dddddn#1swxYwYddddS#1swxYwYdS)Nl rlri )rrr?rlrCr'rTrUs   rtest_large_offsetz LargeMmapTests.test_large_offsets

!
!+t
4
4	3188::qTEUVV
3Z[  9r222
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3s5;BA;/B;A?	?BA?	BBBc"|dd5}tjdkr|t5t
|dt
jdddn#1swxYwY|t5t
|dt
jdddn#1swxYwYt
|dt
j5}|	|
ddddn#1swxYwYddddS#1swxYwYdS)Nlrrr^rr)rrprrFrrr?rlrPrCrRrs   rtest_large_filesizez"LargeMmapTests.test_large_filesizesU

!
!+t
4
4		8{[((&&}55PPIIahhjj+d>NIOOOPPPPPPPPPPPPPPP&&z22FFIIahhjj!D4DIEEEFFFFFFFFFFFFFFF188::wt7GHH
8A  ;777
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8		8		8		8		8		8		8		8		8		8		8		8		8		8		8		8		8		8		8s}+F:B<FB	FB	F-:C3'F3C7	7F:C7	;<F7)E, F,E0	0F3E0	4FFFcd}|t|dzz
}|t|z}|||5}t|dtj5}|||||dddn#1swxYwYddddS#1swxYwYdS)Ns  DEARdear  r0rr^)rErrr?rlrC)r'boundaryrrXrYrTrUs       r_test_around_boundaryz$LargeMmapTests._test_around_boundarys53t99>)c$ii

!
!%
.
.	5!188::q1ABB
5a  59t444
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5	5s6:B=:B%B=%B)	)B=,B)	-B==CCz!test cannot run on 32-bit systemsc:|tdSr")rrr&s rtest_around_2GBzLargeMmapTests.test_around_2GB""3'''''rc:|tdSr")rrr&s rtest_around_4GBzLargeMmapTests.test_around_4GB!rrN)rrrr(r+rrrrrrrprrrrrrrrrs"333

8
8
8555Xs*,OPP((QP(Xs*,OPP((QP(((rr__main__)r) test.supportrrrrrrtest.support.import_helperr	test.support.os_helperr
rrr#rJrrrrrpr,rr=getpidrrrTestCaser rrmainrrr<module>rs54444411111111								















}V=2929;;222((((N
(
L
M
MMG&G&G&G&G&!G&G&G&R:(:(:(:(:(X&:(:(:(zzHMOOOOOr