python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_call.cpython-312.opt-1.pyc

͑eddlZddlmZmZmZ	ddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
GddeZGddej ZeGddej ZGd	d
ej ZGddeZGd
deZGddeZGddeZdZdZGddZeZeZGddej ZdZdZ dZ!dZ"dZ#Gddej Z$Gd d!Z%eGd"d#ej Z&eGd$d%ej Z'Gd&d'ej Z(e)d(k(rejTyy#e$rdZY`wxYw))N)cpython_onlyrequires_limited_api
skip_on_s390xceZdZdZdZy)BadStrcy)NT)selfothers  B/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_call.py__eq__z
BadStr.__eq__sc2tj|dzS)N)str__hash__r
s rrzBadStr.__hash__s||D!A%%rN)__name__
__module____qualname__r
rr	rrrrs&rrceZdZdZdZy)
FunctionCallsctjddg}|jdt|j	}d}|di|}|j|t|jt|j	|y)N)a)brc|SNr	)kws rfnz+FunctionCalls.test_kwargs_order.<locals>.fn sIrr	)collectionsOrderedDictmove_to_endlistitemsassertIsInstancedictassertEqual)r
odexpectedr!ress     rtest_kwargs_orderzFunctionCalls.test_kwargs_ordersp

$
$h%9
:
s
#	h2hc4(ciik*H5rcZd}tdD]}	|d
y#t$rYwxYw)Ncyrr	r	rrfzBFunctionCalls.test_frames_are_popped_after_failed_calls.<locals>.f*sr)range	TypeError)r
r0_s   r)test_frames_are_popped_after_failed_callsz7FunctionCalls.test_frames_are_popped_after_failed_calls's:	t	A
$	

s	**N)rrrr-r5r	rrrrs6	rrceZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+y*)+CFunctionCallsErrorMessagescJd}|jt|ijy)Nz7__contains__\(\) takes exactly one argument \(0 given\)assertRaisesRegexr3__contains__r
msgs  r
test_varargs0z)CFunctionCallsErrorMessages.test_varargs07sHy#r?rcNd}|jt|ijddy)Nz7__contains__\(\) takes exactly one argument \(2 given\)rrr9r<s  r
test_varargs2z)CFunctionCallsErrorMessages.test_varargs2;s!Hy#r1ErcXd}|jt|tjdddy)Nz@^from_bytes\(\) takes at most 2 positional arguments \(3 given\)alittleF)r:r3int
from_bytesr<s  r
test_varargs3z)CFunctionCallsErrorMessages.test_varargs3?s#Qy#s~~tXuUrcd}|jt|ijd}|jt|ijy)Nz'get expected at least 1 argument, got 0zexpected 1 argument, got 0)r:r3get__delattr__r<s  rtest_varargs1minz,CFunctionCallsErrorMessages.test_varargs1minCs88y#rvv6+y#r~~>rc>d}|jt|ty)Nz,getattr expected at least 2 arguments, got 0r:r3getattrr<s  rtest_varargs2minz,CFunctionCallsErrorMessages.test_varargs2minJs=y#w7rcBd}|jt|tddy)Nz(input expected at most 1 argument, got 2rr)r:r3inputr<s  rtest_varargs1maxz,CFunctionCallsErrorMessages.test_varargs1maxNs9y#ua;rcPd}|jt|ijdddy)Nz'get expected at most 2 arguments, got 3rrr)r:r3rHr<s  rtest_varargs2maxz,CFunctionCallsErrorMessages.test_varargs2maxRs#8y#rvvq!Q?rcNd}|jt|ijdy)N+__contains__\(\) takes no keyword argumentsrxr9r<s  rtest_varargs1_kwz,CFunctionCallsErrorMessages.test_varargs1_kwVs"<y#r!DrcPd}|jt|ijddy)NrUrrWyr9r<s  rtest_varargs2_kwz,CFunctionCallsErrorMessages.test_varargs2_kwZs$<y#r!qIrcBd}|jt|tdy)Nz#bool\(\) takes no keyword argumentsrrV)r:r3boolr<s  rtest_varargs3_kwz,CFunctionCallsErrorMessages.test_varargs3_kw^s4y#tq9rcNd}|jt|gjdy)Nz-^list[.]index\(\) takes no keyword arguments$rrV)r:r3indexr<s  rtest_varargs4_kwz,CFunctionCallsErrorMessages.test_varargs4_kwbs">y#rxx1=rcBd}|jt|tdy)Nz(^hasattr\(\) takes no keyword arguments$rrV)r:r3hasattrr<s  rtest_varargs5_kwz,CFunctionCallsErrorMessages.test_varargs5_kwf9y#w!<rcBd}|jt|tdy)Nz(^getattr\(\) takes no keyword arguments$rrVrLr<s  rtest_varargs6_kwz,CFunctionCallsErrorMessages.test_varargs6_kwjrfrcBd}|jt|tdy)Nz%^next\(\) takes no keyword arguments$rrV)r:r3nextr<s  rtest_varargs7_kwz,CFunctionCallsErrorMessages.test_varargs7_kwns6y#tq9rcVd}|jt|tjdy)Nz/^_struct[.]pack\(\) takes no keyword arguments$rrV)r:r3structpackr<s  rtest_varargs8_kwz,CFunctionCallsErrorMessages.test_varargs8_kwrs"@y#v{{a@rcVd}|jt|tjdy)Nz4^_struct[.]pack_into\(\) takes no keyword arguments$rrV)r:r3rm	pack_intor<s  rtest_varargs9_kwz,CFunctionCallsErrorMessages.test_varargs9_kwvs$Ey#v/?/?1Ercrd}|jt|tjjdy)Nz.^deque[.]index\(\) takes no keyword arguments$rrV)r:r3r"dequerar<s  rtest_varargs10_kwz-CFunctionCallsErrorMessages.test_varargs10_kwzs-?y#{/@/@/B/H/HANrcd}|jt|tjjtjddy)Nz.^Struct[.]pack\(\) takes no keyword arguments$rrV)r:r3rmStructrnr<s  rtest_varargs11_kwz-CFunctionCallsErrorMessages.test_varargs11_kw~s5?y#v}}/A/A6==QSCTXYZrcJd}|jt|tty)Nz-^staticmethod\(\) takes no keyword arguments$func)r:r3staticmethodidr<s  rtest_varargs12_kwz-CFunctionCallsErrorMessages.test_varargs12_kws>y#|"ErcJd}|jt|tty)Nz,^classmethod\(\) takes no keyword arguments$r{)r:r3classmethodr~r<s  rtest_varargs13_kwz-CFunctionCallsErrorMessages.test_varargs13_kws=y#{DrcZd}|jt|tjdddy)Nz:^product\(\) takes at most 1 keyword argument \(2 given\)$rrr)repeatfoo)r:r3	itertoolsproductr<s  rtest_varargs14_kwz-CFunctionCallsErrorMessages.test_varargs14_kws.Ky#(00!A1		Frc
Jd}|jt|tdddddy)Nz?^ImportError\(\) takes at most 3 keyword arguments \(4 given\)$rrrr)namepath	name_fromr)r:r3ImportErrorr<s  rtest_varargs15_kwz-CFunctionCallsErrorMessages.test_varargs15_kws-Py#*AAAPQ		Src	Hd}|jt|tddddy)Nz7^min\(\) takes at most 2 keyword arguments \(3 given\)$rrrr)defaultkeyr)r:r3minr<s  rtest_varargs16_kwz-CFunctionCallsErrorMessages.test_varargs16_kws*Hy#"AqaQ		@rcLd}|jt|tdddddd	y)	Nz3'foo' is an invalid keyword argument for print\(\)$rrrr)sependfileflushr)r:r3printr<s  rtest_varargs17_kwz-CFunctionCallsErrorMessages.test_varargs17_kws.Dy#$aQAAQA		Orcd}|jt|5tditddidddy#1swYyxYw)Nz'invalid keyword argument for print\(\)$r,)rr)r:r3rrr<s  rtest_varargs18_kwz-CFunctionCallsErrorMessages.test_varargs18_kws@8

#
#Is
3	0/6%=#./	0	0	0	9Acd}|jt|5tditddidddy#1swYyxYw)Nz'invalid keyword argument for round\(\)$rr)g?)r:r3roundrr<s  rtest_varargs19_kwz-CFunctionCallsErrorMessages.test_varargs19_kws@8

#
#Is
3	.-6%=!,-	.	.	.rcLd}|jt|ijdy)Nz'keys\(\) takes no arguments \(1 given\)rr:r3keysr<s  rtest_oldargs0_1z+CFunctionCallsErrorMessages.test_oldargs0_1s8y#rww:rcNd}|jt|ijddy)Nz'keys\(\) takes no arguments \(2 given\)rrrr<s  rtest_oldargs0_2z+CFunctionCallsErrorMessages.test_oldargs0_2s!8y#rww1=rcNd}|jt|ijdy)N#keys\(\) takes no keyword argumentsrrVrr<s  rtest_oldargs0_1_kwz.CFunctionCallsErrorMessages.test_oldargs0_1_kws"4y#rww!<rcPd}|jt|ijddy)NrrrZrr<s  rtest_oldargs0_2_kwz.CFunctionCallsErrorMessages.test_oldargs0_2_kws$4y#rww!qArcJd}|jt|gjy)Nz0count\(\) takes exactly one argument \(0 given\)r:r3countr<s  rtest_oldargs1_0z+CFunctionCallsErrorMessages.test_oldargs1_0sAy#rxx8rcNd}|jt|gjddy)Nz0count\(\) takes exactly one argument \(2 given\)rrrr<s  rtest_oldargs1_2z+CFunctionCallsErrorMessages.test_oldargs1_2s!Ay#rxxA>rcNd}|jt|gjdyN$count\(\) takes no keyword argumentsrrVrr<s  rtest_oldargs1_0_kwz.CFunctionCallsErrorMessages.test_oldargs1_0_kws"5y#rxx1=rcPd}|jt|gjidyrrr<s  rtest_oldargs1_1_kwz.CFunctionCallsErrorMessages.test_oldargs1_1_kws$5y#rxxqArcPd}|jt|gjddy)NrrrZrr<s  rtest_oldargs1_2_kwz.CFunctionCallsErrorMessages.test_oldargs1_2_kws$5y#rxx1BrcFd}|jt|ty)Nz!^'object' object is not callable$)r:r3objectr<s  rtest_object_not_callablez4CFunctionCallsErrorMessages.test_object_not_callables2y#vx8rc\d}|jt|tjdyN!^'module' object is not callable$mod)r:r3types
ModuleTyper<s  r(test_module_not_callable_no_suggestion_0zDCFunctionCallsErrorMessages.test_module_not_callable_no_suggestion_0s$2y#u/?/?/FGrcnd}tjd}d|_|jt||yNrr*rrrr:r3r
r=rs   r(test_module_not_callable_no_suggestion_1zDCFunctionCallsErrorMessages.test_module_not_callable_no_suggestion_1s02u%y#s3rcdd}tjd}|`|jt||yrrrrr:r3rs   r(test_module_not_callable_no_suggestion_2zDCFunctionCallsErrorMessages.test_module_not_callable_no_suggestion_2s.2u%Ly#s3rcnd}tjd}d|_|jt||yrrrs   r(test_module_not_callable_no_suggestion_3zDCFunctionCallsErrorMessages.test_module_not_callable_no_suggestion_3s02u%y#s3rcpd}tjd}d|_|jt||y)NzH^'module' object is not callable\. Did you mean: 'mod\.mod\(\.\.\.\)'\?$rcy)N.r	r	rr<lambda>zQCFunctionCallsErrorMessages.test_module_not_callable_suggestion.<locals>.<lambda>rrrs   r#test_module_not_callable_suggestionz?CFunctionCallsErrorMessages.test_module_not_callable_suggestions0Yu%y#s3rN),rrrr>r@rFrJrNrQrSrXr\r_rbrerhrkrorrruryrrrrrrrrrrrrrrrrrrrrrrrr	rrr7r74s@FV?8<@EJ:>==:AFO[FEF
S
@
O
0.;>=B9?>BC9H4444rr7ceZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZy)TestCallingConventionsaTest calling using various C calling conventions (METH_*) from Python

    Subclasses test several kinds of functions (module-level, methods,
    class methods static methods) using these attributes:
      obj: the object that contains tested functions (as attributes)
      expected_self: expected "self" argument to the C function

    The base class tests module-level functions.
    c(tx|_|_yr)	_testcapiobj
expected_selfrs rsetUpzTestCallingConventions.setUps(114%rcv|j|jjddd|jdfyNrrrrrrr)rmeth_varargsrrs rtest_varargsz#TestCallingConventions.test_varargss4HH!!!Q*


+	
rcn|j|jjd|jdfyNrrrs rtest_varargs_extz'TestCallingConventions.test_varargs_exts2!DHH!!9-


+	
rc>d}jt|fdy)Nz+meth_varargs\(\) takes no keyword argumentsc<jjdSNr)k)rrrsrrz>TestCallingConventions.test_varargs_error_kw.<locals>.<lambda>sDHH$9$9A$9$>rr:r3r<s` rtest_varargs_error_kwz,TestCallingConventions.test_varargs_error_kw	s<s>	
rc|j|jjdddd|jddddfyNrrrrrrrrr)rmeth_varargs_keywordsrrs rtest_varargs_keywordsz,TestCallingConventions.test_varargs_keywordss@HH**1a1*:


qq)9:	
rc	|j|jjddgiddd|jddddfyrrrs rtest_varargs_keywords_extz0TestCallingConventions.test_varargs_keywords_extsG*DHH**QFGAA6FG


qq)9:	
rcr|j|jjd|jdfyNrr)rmeth_orrs rtest_ozTestCallingConventions.test_os*+d.@.@!-DErcp|j|jjdg|jdfyrrrs r
test_o_extz!TestCallingConventions.test_o_exts.1#.1C1CQ0GHrc^d}|jt||jjy)Nz1meth_o\(\) takes exactly one argument \(0 given\))r:r3rrr<s  rtest_o_error_no_argz*TestCallingConventions.test_o_error_no_arg!s!By#txx?rc>d}jt|fdy)Nz1meth_o\(\) takes exactly one argument \(2 given\)c<jjddSNrrrrrsrrz>TestCallingConventions.test_o_error_two_args.<locals>.<lambda>(sDHHOOAq$9rrr<s` rtest_o_error_two_argsz,TestCallingConventions.test_o_error_two_args%sBs9	
rc>d}jt|fdy)Nz1meth_o\(\) takes exactly one argument \(3 given\)c6jjdSrrrsrrz9TestCallingConventions.test_o_error_ext.<locals>.<lambda>.sODHHOOY$?rrr<s` rtest_o_error_extz'TestCallingConventions.test_o_error_ext+sBs?	
rc>d}jt|fdy)N%meth_o\(\) takes no keyword argumentsc<jjdSrrrsrrz8TestCallingConventions.test_o_error_kw.<locals>.<lambda>4DHHOOaO$8rrr<s` rtest_o_error_kwz&TestCallingConventions.test_o_error_kw16s8	
rc>d}jt|fdy)Nrc<jjdSrrrsrrz<TestCallingConventions.test_o_error_arg_kw.<locals>.<lambda>:r
rrr<s` rtest_o_error_arg_kwz*TestCallingConventions.test_o_error_arg_kw7rrcl|j|jj|jyrr)rmeth_noargsrrs rtest_noargsz"TestCallingConventions.test_noargs=s%--/1C1CDrcj|j|jjg|jyrrrs rtest_noargs_extz&TestCallingConventions.test_noargs_ext@s*---r2D4F4FGrc>d}jt|fdy)Nz.meth_noargs\(\) takes no arguments \(1 given\)c:jjdSrrrrsrrz>TestCallingConventions.test_noargs_error_arg.<locals>.<lambda>FsDHH$8$8$;rrr<s` rtest_noargs_error_argz,TestCallingConventions.test_noargs_error_argCs?s;	
rc>d}jt|fdy)Nz.meth_noargs\(\) takes no arguments \(2 given\)c<jjddSrrrsrrz?TestCallingConventions.test_noargs_error_arg2.<locals>.<lambda>LsDHH$8$8A$>rrr<s` rtest_noargs_error_arg2z-TestCallingConventions.test_noargs_error_arg2Is?s>	
rc>d}jt|fdy)Nz.meth_noargs\(\) takes no arguments \(3 given\)c6jjdSrrrsrrz>TestCallingConventions.test_noargs_error_ext.<locals>.<lambda>Rs$8DHH$8$8)$Drrr<s` rtest_noargs_error_extz,TestCallingConventions.test_noargs_error_extOs?sD	
rc>d}jt|fdy)Nz*meth_noargs\(\) takes no keyword argumentsc<jjdSrrrsrrz=TestCallingConventions.test_noargs_error_kw.<locals>.<lambda>XsDHH$8$81$8$=rrr<s` rtest_noargs_error_kwz+TestCallingConventions.test_noargs_error_kwUs;s=	
rcv|j|jjddd|jdfyrr)r
meth_fastcallrrs r
test_fastcallz$TestCallingConventions.test_fastcall[s4HH""1a+


+	
rcn|j|jjd|jdfyrr$rs rtest_fastcall_extz(TestCallingConventions.test_fastcall_extas2"DHH""I.


+	
rc>d}jt|fdy)Nz,meth_fastcall\(\) takes no keyword argumentsc<jjdSr)rr%rsrrz?TestCallingConventions.test_fastcall_error_kw.<locals>.<lambda>jsDHH$:$:Q$:$?rrr<s` rtest_fastcall_error_kwz-TestCallingConventions.test_fastcall_error_kwgs=s?	
rc|j|jjdddd|jddddfyrr)rmeth_fastcall_keywordsrrs rtest_fastcall_keywordsz-TestCallingConventions.test_fastcall_keywordsms@HH++AqA+;


qq)9:	
rc	|j|jjdiddd|jddddfy)Nrrrrr-rs rtest_fastcall_keywords_extz1TestCallingConventions.test_fastcall_keywords_extssC+DHH++VHQQ7GH


qq)9:	
rN)rrr__doc__rrrrrrrrrrrrrrrrrrr"r&r(r+r/r1r	rrrrs2




FI@



EH








rrceZdZdZdZy)TestCallingConventionsInstancez?Test calling instance methods using various calling conventionscDtjx|_|_yr)rMethInstancerrrs rrz$TestCallingConventionsInstance.setUp}s(1(>(>(@@4%rNrrrr2rr	rrr4r4zsIArr4ceZdZdZdZy)TestCallingConventionsClassz<Test calling class methods using various calling conventionsc<tjx|_|_yrr	MethClassrrrs rrz!TestCallingConventionsClass.setUps(1(;(;;4%rNr7r	rrr9r9s
F<rr9ceZdZdZdZy)#TestCallingConventionsClassInstancez&Test calling class methods on instancec`tj|_tj|_yrr;rs rrz)TestCallingConventionsClassInstance.setUps &&(&00rNr7r	rrr>r>s
01rr>ceZdZdZdZy)TestCallingConventionsStaticz=Test calling static methods using various calling conventionscDtj|_d|_yr)r
MethStaticrrrs rrz"TestCallingConventionsStatic.setUps'')!rNr7r	rrrArAs
G"rrAc
||gSrr	arg1arg2s  rpyfuncrHs$<rcyNnoargr	r	rrpyfunc_noargrLsrc8eZdZdZdZedZedZy)PythonClassc
||gSrr	)r
rFrGs   rmethodzPythonClass.methodsd|rcyrJr	rs rmethod_noargzPythonClass.method_noargsrcy)Nrr	)clss rclass_methodzPythonClass.class_methodsrcy)Nr}r	r	rr
static_methodzPythonClass.static_methodsrN)	rrrrPrRrrUr}rWr	rrrNrNs4rrNcneZdZdZedddgfeddfejddfejddfe	jdddgfe	jddfe	jddfe	jddfgZed	d
diddgfeddddddgfe	jd	d
diddgfe	jddddddgfgZ
ejZeefeefej"ej"fej"ej"fej$dffD]%\ZZej+ej,dedffej.dedeffej2dedffej2dedffej4dedeffej4dedeffej6defej8d
edffge
j+ej.dddiedddiffej.dddiedddiffej.diedeffej4dddiedddiffej4dddiedddiffej4diedeffg(dZdZdZdZ dZ!y)
FastCallTestsz0Test calling using various callables from C
    rrrr	rKrr})rrGrEN){rZrWr[ct|tr!|dtur|didfvr
g|dd|d}|j||y)N)
isinstancetuple
NULL_OR_EMPTYr))r
resultr+s   rcheck_resultzFastCallTests.check_resultsPh&8B<=+Hbzb$Z'7Xcr]7F2J7*rc"|jD]t\}}}|j||5tj||}|j	|||s(tj|d}|j	||dddvy#1swYxYw)Nr|args)
CALLS_POSARGSsubTestrpyobject_fastcallra)r
r|rdr+r`s     rr&zFastCallTests.test_fastcall
s%)$6$6	8 D$4d3
8"44T4@!!&(3&88tDF%%fh7
8
8	8
8
8sABB	c|jD]v\}}}|j||5tj||d}|j	|||s)tj|dd}|j	||dddx|j
D]M\}}}}|j|||5tj|||}|j	||dddOy#1swYxYw#1swYfxYw)Nrcr|rdkwargs)rerfrpyobject_fastcalldictraCALLS_KWARGS)r
r|rdr+r`rjs      rtest_vectorcall_dictz"FastCallTests.test_vectorcall_dicts%)$6$6		8 D$4d3
8"88tTJ!!&(3&<<T4NF%%fh7
8
8		8-1,=,=	4(D$4d6B
4"88tVL!!&(3
4
4	4
8
8
4
4sAC#.*C/#C,	/C8	c|jD]\}}}|j||5tj||d}|j	||tj||d}|j	|||sRtj|dd}|j	||tj|dd}|j	||ddd|j
D]\}}}}|j|||5t
|j}|t
|jz}tj|||}|j	||dddy#1swYgxYw#1swYxYw)Nrcr	ri)	rerfrpyobject_vectorcallrarlr^rvalues)r
r|rdr+r`rjkwnamess       rtest_vectorcallzFastCallTests.test_vectorcall*sv%)$6$6	8 D$4d3
8"66tT4H!!&(3#66tT2F!!&(3&::4tLF%%fh7'::4rJF%%fh7!
8
8	8&-1,=,=	4(D$4d6B
4
.eFMMO44"66tT7K!!&(3	
4
4	4%
8
8&
4
4sB'E*AE7*E4	7F	cfGdd}||}tddd|fi|jy)NceZdZdgZdZdZy)>FastCallTests.test_fastcall_clearing_dict.<locals>.IntWithDictrjc||_yr)rj)r
rjs  r__init__zGFastCallTests.test_fastcall_clearing_dict.<locals>.IntWithDict.__init__Ls	$rc`|jjtjy)Nr)rjcleargccollectrs r	__index__zHFastCallTests.test_fastcall_clearing_dict.<locals>.IntWithDict.__index__Ns!!#

rN)rrr	__slots__rwr|r	rrIntWithDictruJs!
I
%
rr~)optimizepassrwexec)compilerj)r
r~rWs   rtest_fastcall_clearing_dictz)FastCallTests.test_fastcall_clearing_dictGs3		
/	FA22r)"rrrr2rHrLrNrUrWPYTHON_INSTANCErPrRrerlrr6	_instancer<rCrrextendrrr_r%r.rrrar&rmrrrr	rrrYrYs0
!Q 
r7#
	!	!2}5		"	"B7
		!Q0		%	%r73		%	%r=9		&	&N;#M6
{QF+	a+aV4
		{QF;			a%;aVDL'	&&(I	I	I			i112					 3 34			t$"]	


v
v'>?

&
&
>
@


(?@


]B$78

'
'
>
@

'
']B
6
8
__b-0
ZZ=#"67
		

&
&c
]FS#J$G
I

&
&S#JS#J ?
A

&
&]FMB
D

'
'c
]FS#J$G
I

'
'S#JS#J ?
A

'
']FMB
D


	+"H+84&4:3rrYiic|Szsome docr	rs rtestfunctionr]Krc|Srr	)r
r s  rtestfunction_kwrbrrrcreZdZdZdZdZdZdZdZdZ	dZ
d	Zed
Z
edZedZy
)
TestPEP590cddl}|jdt}|jt	t
jtz|jt	tjjtz|jt	tjjtz|jt	tjtz|jt	|jtz|jtjjtz|jtjjtz|jtjjtzGddtj}|j|jtzy)NrrceZdZy)DTestPEP590.test_method_descriptor_flag.<locals>.MethodDescriptorHeapNrrrr	rrMethodDescriptorHeapr{rr)	functools	lru_cacherassertFalsetyperepr	__flags__Py_TPFLAGS_METHOD_DESCRIPTOR
assertTruer%append__add__rMethodDescriptorBaseMethodDescriptorDerivedMethodDescriptorNopGet)r
rcachedrs    rtest_method_descriptor_flagz&TestPEP590.test_method_descriptor_flagls>'$$Q'5d--0LLMT[[)336RRST\\*447SST\*447SSTV..1MMN	66@@C__`	99CCFbbc99CCFbbc	9#A#A	-77:VVWrc|jtjjtz|jtj
jtz|j
tjjtz|jtjjtzGddtj}|j|jtzt|_
|j
|jtzGddtj}|j
|jtzy)NceZdZy)=TestPEP590.test_vectorcall_flag.<locals>.MethodDescriptorHeapNrr	rrrrrrrceZdZdZy)rcyrr	rs r__call__zFTestPEP590.test_vectorcall_flag.<locals>.MethodDescriptorHeap.__call__srNrrrrr	rrrz=TestPEP590.test_vectorcall_flag.<locals>.MethodDescriptorHeaps
r)rrrrPy_TPFLAGS_HAVE_VECTORCALLrrrMethodDescriptor2rr)r
rs  rtest_vectorcall_flagzTestPEP590.test_vectorcall_flags	66@@C]]^	99CCF``a99CCF``a	33==@ZZ[	9#A#A	,669SST(-%-77:TTU	9#A#A		
-77:TTUrc~ttd}tj}|j	|||y)Nr)r^r2rrassertIs)r
rdr0s   rtest_vectorcall_overridez#TestPEP590.test_vectorcall_overrides1U1X,,.

ah%rctj}|}|j|d|j||j|dd|_|j|dy)z*Setting __call__ should disable vectorcalltp_call
vectorcallcyNcustomr	rs rrzFTestPEP590.test_vectorcall_override_on_mutable_class.<locals>.<lambda>rrrN)rmake_vectorcall_classr)set_vectorcallr)r
TestTypeinstances   r)test_vectorcall_override_on_mutable_classz4TestPEP590.test_vectorcall_override_on_mutable_classsc224:Y/)\21X.rcDtj}Gdd|}|}tj|}tj|}|jt|||jt|||j	|d|j	tj
|d|j	tj
|d|j	tj
|d|j	tj
|d|j
||j	|d|j	tj
|d|j	tj
|d|j	tj
|d|j	tj
|dd|_|j	|d|j	tj
|d|j	tj
|d|j	tj
|d|j	tj
|dy	)
z:Setting __call__ on a superclass should disable vectorcallceZdZy)FTestPEP590.test_vectorcall_override_with_subclass.<locals>.DerivedTypeNrr	rrDerivedTyperrrrrTrcyrr	rs rrzCTestPEP590.test_vectorcall_override_with_subclass.<locals>.<lambda>rrrFN)rrr
issubclassr)has_vectorcall_flagrr)r
	SuperTyperrUnaffectedType1UnaffectedType2s      r&test_vectorcall_override_with_subclassz1TestPEP590.test_vectorcall_override_with_subclasss335		)	=$99+F#99)D	

?K@A
?I>?	
Y/66yA4H66{CTJ66GN66GN		*\266yA4H66{CTJ66GN66GN3	X.66yA5I66{CUK66GN66GNrcttdfidftjgdfidfgjdidftdgfddidft
didftdddidftjdid	ftjdid	ftjdid
fg	}ddlmm}ddl
m}dd
lm}fd}|D]_\}}}}	|j#t%|5|s|j'|	||||j'|	||||dddaGddtj}
Gddtj}Gdd}Gdd|tj}
|t(j*ifdd	idfij*ifdd	idf|
did	f|didf|
did	fgz
}|D]\}}}}	|j#t%|5|dd}|||d}||}|sY|j'|	|||j'|	||d|j'|	|||j'|	|||j'|	||i||j'|	|||||j'|	||i||j'|	||i|dddy#1swYxYw#1swYxYw)Nrr)r$start)rr TF)ropyvectorcall_call)
MethodType)partialcXg||j}t|}|||Sr)rpr^)r|rdrjrqros    rrz.TestPEP590.test_vectorcall.<locals>.vectorcalls0*D*6==?*DFmG&tT7;;rceZdZy)8TestPEP590.test_vectorcall.<locals>.MethodDescriptorHeapNrr	rrrrrrrceZdZdZy)>TestPEP590.test_vectorcall.<locals>.MethodDescriptorOverriddency)Nnewr	)r
ns  rrzGTestPEP590.test_vectorcall.<locals>.MethodDescriptorOverridden.__call__srNrr	rrMethodDescriptorOverriddenrs
rrceZdZfdZxZS)-TestPEP590.test_vectorcall.<locals>.SuperBasect||Srsuperrr
rd	__class__s  rrz6TestPEP590.test_vectorcall.<locals>.SuperBase.__call__w'..rrrrr
__classcell__rs@r	SuperBaser

/
/rrceZdZfdZxZS)9TestPEP590.test_vectorcall.<locals>.MethodDescriptorSuperct||Srrrs  rrzBTestPEP590.test_vectorcall.<locals>.MethodDescriptorSuper.__call__rrrrs@rMethodDescriptorSuperrrrrrrr)lenr2r%rsumrrrrrrrorrrrrrfrr)r(update)r
callsrrrrr|rdrjr+rrrrargs1methwrappedros                 @rrrzTestPEP590.test_vectorcallsb	|R,++AwD1))T2t,wR0r2.!54+r:002D"dC335tRF--/r5AC	E$%	<
/4	R*T4c$i(
R$$X/@t/LM  +<T4+PQ
R
R	R	9#A#A		)G)G		/	/	/Iy/M/M	/	
[[2%%t4
YYd|T2
!
#T2t4
'
)4U;
"
$dB5
	
/4
	E*T4c$i(
EQR!$Q0!$-$$XtT{;$$X/B4t/TU$$XtU|<$$Xw~>  4+@+@A  :dD&+IJ  4+A&+AB  7D+CF+CD
E
E
	E?
R
R@
E
Es6K$CKK	K	cddlm}d}|j}d}|d||||tdtzD]}|d||y)Nrfunction_setvectorcallc|dzSrr	)nums rr0z(TestPEP590.test_setvectorcall.<locals>.f s
37Nr

overridden)rrr)r2ADAPTIVE_WARMUP_DELAY)r
rr0assert_equalrr4s      rtest_setvectorcallzTestPEP590.test_setvectorcallsV4"''R3 q!r112	/Aqv.	/rcddlm}Gdd}|j}|}|d|j||jttD]}|d|jy)NrrceZdZdZy)FTestPEP590.test_setvectorcall_load_attr_specialization_skip.<locals>.Xc|Srr	r
attrs  r__getattribute__zWTestPEP590.test_setvectorcall_load_attr_specialization_skip.<locals>.X.__getattribute__-rNrrrrr	rrXr,
rrrr)rrr)rrr2r)r
rrrrWr4s      r0test_setvectorcall_load_attr_specialization_skipz;TestPEP590.test_setvectorcall_load_attr_specialization_skip)sd4		''
CS!##q112,-	,Aqss+	,rcddlm}Gdd}d}|j}|}ttD]}|d||||j
ttD]}|d||y)NrrceZdZdZy)GTestPEP590.test_setvectorcall_load_attr_specialization_deopt.<locals>.Xc|Srr	rs  rrzXTestPEP590.test_setvectorcall_load_attr_specialization_deopt.<locals>.X.__getattribute__=rrNrr	rrrr<rrrc|jSr)rrVs rget_azKTestPEP590.test_setvectorcall_load_attr_specialization_deopt.<locals>.get_a@s33Jrrr)rrr)r2rr)r
rrrrrWr4s       r1test_setvectorcall_load_attr_specialization_deoptz<TestPEP590.test_setvectorcall_load_attr_specialization_deopt9s~4			''
C,-	(AeAh'	(q112,-	1AuQx0	1rclddlm}tj}|j||dddy)Nr)ror	zvectorcall called)rroLimitedVectorCallClassr))r
rors   r test_vectorcall_limited_incomingz+TestPEP590.test_vectorcall_limited_incomingNs.1..0,S"b9;NOrcddlm}ggfd}|j||d|jdg|jddigy)Nr)call_vectorcallcJj|j|yNsuccessr)rdrj
args_capturedkwargs_captureds  rr0z6TestPEP590.test_vectorcall_limited_outgoing.<locals>.f[s"  &""6*rrrbazbar)rrr))r
rr0rrs   @@r test_vectorcall_limited_outgoingz+TestPEP590.test_vectorcall_limited_outgoingTsU-
	
	
+Y7
3E5>*:;rcddlm}ggGfdd}|j||d|jdg|jddigy)	Nr)call_vectorcall_methodceZdZfdZy)HTestPEP590.test_vectorcall_limited_outgoing_method.<locals>.TestInstancecJj|j|yrr)r
rdrjrrs   rr0zJTestPEP590.test_vectorcall_limited_outgoing_method.<locals>.TestInstance.fls"$$T*&&v. rN)rrrr0)rrsrTestInstancerks
!rr!rrrr)rrr))r
rr!rrs   @@r'test_vectorcall_limited_outgoing_methodz2TestPEP590.test_vectorcall_limited_outgoing_methodds]4
	!	!	
/?K
3E5>*:;rN)rrrrrrrrrrrrrrrrr"r	rrrrjstX&V*&/'OTJEX	/, 1*PP

<
<<<rrc2eZdZdZedZedZy)Acyrr	)r
rWr[s   rmethod_two_argszA.method_two_argsvsrcyrr	r	rrstatic_no_argszA.static_no_argsyrcyrr	args rpositional_onlyzA.positional_only}r)rN)rrrr&r}r(r-r	rrr$r$us/




rr$cNeZdZejdZdZdZdZdZ	dZ
y)!TestErrorMessagesUseQualifiedNamec#K|jt5}dddd|jtj|y#1swY/xYwwr)assertRaisesr3r)r	exception)r
messagecms   rcheck_raises_type_errorz9TestErrorMessagesUseQualifiedName.check_raises_type_errorsF


y
)	R	R\\*G4		sAA.AAAcd}|j|5tjddddy#1swYyxYw)Nz?A.method_two_args() missing 1 required positional argument: 'y'rWr5r$r&r<s  rtest_missing_argumentsz8TestErrorMessagesUseQualifiedName.test_missing_argumentss:O

)
)#
.	%
C$	%	%	%s	7Ac~d}|j|5tjddddy#1swYyxYw)Nz?A.static_no_args() takes 0 positional arguments but 1 was givenzoops it's an arg)r5r$r(r<s  rtest_too_many_positionalz:TestErrorMessagesUseQualifiedName.test_too_many_positionals9O

)
)#
.	1
/0	1	1	1s3<cd}|j|5tjddddy#1swYyxYw)NzYA.positional_only() got some positional-only arguments passed as keyword arguments: 'arg'rWr+)r5r$r-r<s  r&test_positional_only_passed_as_keywordzHTestErrorMessagesUseQualifiedName.test_positional_only_passed_as_keywords;i

)
)#
.	'
#&	'	'	's4=cd}|j|5tjddddy#1swYyxYw)Nz<A.method_two_args() got an unexpected keyword argument 'bad'rW)badr7r<s  rtest_unexpected_keywordz9TestErrorMessagesUseQualifiedName.test_unexpected_keywords=L

)
)#
.	)
CC(	)	)	)s	8Acd}|j|5tjddddddy#1swYyxYw)Nz8A.method_two_args() got multiple values for argument 'x'rWr[oopsrVr7r<s  rtest_multiple_valuesz6TestErrorMessagesUseQualifiedName.test_multiple_valuessAH

)
)#
.	4
CSF3	4	4	4s	:AN)rrr
contextlibcontextmanagerr5r8r:r<r?rBr	rrr/r/s555
%
1
'
)
4rr/ceZdZedZy)
TestRecursioncDfdfdfdfdtj}tjd	d|jt5ddddd|jt5ddddd	|jt5ddddtj|y#1swY{xYw#1swYYxYw#1swY7xYw#tj|wxYw)
Nc"|r|dz
yyrr	)rrecurses rrIz.TestRecursion.test_super_deep.<locals>.recurses!rc:|r
|dz
|y|dz
yrr	)rmc_py_recurse
py_recurses  rrMz1TestRecursion.test_super_deep.<locals>.py_recurses 1Q3"QqS!rc@|rtj|dz
fyyrrrg)r	c_recurses rrPz0TestRecursion.test_super_deep.<locals>.c_recurses!++I!v>rc<|rtjd|fyy)Nr1rO)rKrMs rrLz3TestRecursion.test_super_deep.<locals>.c_py_recurses++Jq	Brii_idZ)sysgetrecursionlimitsetrecursionlimitr1RecursionError)r
depthrLrPrMrIs  @@@@rtest_super_deepzTestRecursion.test_super_deeps		"	?	C%%'g&	)FO"">2
! 
!cN"">2
"&!
""">2
&W%
&
!!%(
!
!
"
"
&
&
!!%(sTD!	C$*%D	C0%D=	C<D$C-)D0C95D<DDDN)rrrrrYr	rrrFrFs!)!)rrFceZdZdZy)TestFunctionWithManyArgsc	<dD]}|j|5djt|Dcgc]}d|	c}}d|d|dz}i}t|i||j	|dt||dzdddycc}w#1swYxYw)	N)rir1)Nrrzdef f(z) : return arr0)rfjoinr2rr))r
r]irdsrcls      rtest_function_with_many_argsz5TestFunctionWithManyArgs.test_function_with_many_argss 	:A"
:xx%( ;Q1QC ;<tfLA7S"a   3q!2AqD9
:
:	: ;
:
:sBB
AB
BB	N)rrrrbr	rrr[r[s:rr[__main__)+unittesttest.supportrrrrrrmr"rrzrCrTrrrTestCaserr7rr4r9r>rArHrLrNrrr_rYrrrrrrr$r/rFr[rmainr	rr<module>rhsJJ	
&S&H%%8w4("3"3w4w4tH
X..H
VA%;A<"8<1*@1"#9"

 -
b3H%%b3J%&

I<""I<V



4(9(944B$)H%%$)$)L:x00:zHMMOaIsE**E54E5