403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.202
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python315/Lib/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python315/Lib/test/__pycache__/test_signal.cpython-315.pyc
R
>lqj�c	��]PHs]PHs]PHs]PHs]PHs]PHs]PHs]PHs]PH s]PH$s	]PH(s
]PH,s]PH0s]PH4s
]QH8Gs]QH@GsGsGsGsGs]QHXGsGs]PHfsQQ\
O62s\
O:\
O<Q6HQ2QQ	\
O622s\
O@\
O<Q6HQ
2QQ\
O622s!Q
Q\
O62s"\
O:\
O<Q6HQ2QQ\
O622s#\
O@\$\Q2Q2QQ\
O622s%\
O:\
O<Q6HQ2\
O@\$\Q2Q2\OL2\
O@\$\Q2Q2QQ\
O622222s'\
O:\
O<Q6HQ2\
O@\$\Q29%c
\$\Q2Q2QQ\
O6222s(Q Q!\
O62s)Q"Q#\
O62s*Q$Q%\
O62s+Q&Q'\
O62s,Q(s-\.Q)6Xc\
O^2P!P!\cPsCKoh9h)*�)�support)�force_not_colorized�is_apple�is_apple_mobile�	os_helper�threading_helper)�assert_python_ok�spawn_pythonc�.`�\sQs]snQsQsQsUsP!)�GenericTestsc�R�[[2FCDo[[U2oUQ
7c#UOU[O2J=UQ7c#UOU[O
2JfUO
Q2%c:UO
Q2%f#UOU[O2J�UO
Q2%fJ�UOU[O2UO[OQ2CJ	[O[OQQQ[Q5o[OU[O2[O[OQ	QQ
[Q5o[OU[O2[[QP2oUdG[O[OQQQ[Q5o[OVe2P!P!)�SIG_DFL�SIG�SIG_�CTRL_�win32�Signals�signalc���UO29%c8UOQ29%cUOQ2%(9%fUOQ2!)rrr)�isupper�
startswith��names&�%C:\Python315\\Lib\test\test_signal.py�<lambda>�)GenericTests.test_enums.<locals>.<lambda>+sR���L�L�N�Q�Q�����/�O�O�����8O�4O�0�0����w�/�0�)�source�Handlersc��UQ7!)r
)r
�SIG_IGN�rs&rrr5s
��T�%;�;r�Sigmasksc��UQ7!)�	SIG_BLOCK)r$�SIG_UNBLOCK�SIG_SETMASKr!rs&rrr>s
���)T�!Tr>r
r >r$r&r%)�dirr�getattr�assertIsInstancerr"rr�assertEqual�sys�platform�enum�
_old_convert_�IntEnum�_test_simple_enum)�selfr�sig�CheckedSignals�CheckedHandlersr"�CheckedSigmaskss&      r�
test_enums�GenericTests.test_enumss~����K�K�D��&�$�'�C��-�-��%�%�c�6�?�?�;��D�D��%�%�c�6�?�?�;�����'�'�����0G�0G��%�%�c�6�>�>�:�����)�)��%�%�c�6�>�>�:�� � ����w�7� ��+�+����i��0��
��	
���~�v�~�~�>��,�,����j�(�;����
	
�������@��6�:�t�4����"�0�0��L�L�*�h�T�!��O�

�"�"�?�=�
 rc��[[2FDko[[U2o[OU2%fJ1[O
U2%cJOUO
UOQ2Jm	P!)r)r'rr(�inspect�	isroutine�	isbuiltinr*�
__module__)r1r�values&  r�test_functions_module_attr�'GenericTests.test_functions_module_attrCsU����K�D��F�D�)�E�� � ��'�'��0A�0A�%�0H�0H�� � ��!1�!1�8�<� rr!)�__name__r<�__qualname__�__firstlineno__r6r>�__static_attributes__�__classdictcell__��
__classdict__s@rrrs����%>�N=�=rrrzNot valid on Windowsc�^`�\sQs]LsnQsQsQsQsQsQs	\
O\OOQ2Q2Q	2sQ
s\
O"\\Q2Q2Q
2s\
O"\O*Q2\O.2Q22sQsUsP!)�
PosixTestsc��P!�Nr!�r1�argss&*r�trivial_signal_handler�!PosixTests.trivial_signal_handlerNs��rc�F�[OUOU2!rJ)�	functools�partialrM)r1�arguments&&r�create_handler_with_partial�&PosixTests.create_handler_with_partialQs��� � ��!<�!<�h�G�Grc��UO[[OQ2UO[[OQUO2UO[[O
Q2P!)i�)�assertRaises�
ValueErrorr�	getsignalrM�	strsignal�r1s&r�,test_out_of_range_signal_number_raises_error�7PosixTests.test_out_of_range_signal_number_raises_errorTsU�����*�f�&6�&6��=����*�f�m�m�T��5�5�	7�	
���*�f�&6�&6��=rc�p�UO[[O[OP2P!rJ)rV�	TypeErrorr�SIGUSR1rZs&r�0test_setting_signal_handler_to_none_raises_error�;PosixTests.test_setting_signal_handler_to_none_raises_error\s!�����)�V�]�]� �.�.�$�	0rc���[O[OUO2oUOU[O2UO[O[O2UO2[O[OU2UO[O[O2U2P!rJ)r�SIGHUPrMr)rr*rX)r1�hups& r�test_getsignal�PosixTests.test_getsignal`s����m�m�F�M�M�4�+F�+F�G�����c�6�?�?�3�����)�)�&�-�-�8��4�4�	6��
�
�f�m�m�S�)�����)�)�&�-�-�8�#�>rc�`�QQ2oU2oUO]UO2UOU2o[O[OU2oUOU[O2UO[O[O2U2[O[OU2UO[O[O2U2UO]UO2P!)c�:``�\sQs]ksnQsU1QksQsUsU9s!)�GPosixTests.test_no_repr_is_called_on_signal_handler.<locals>.MyArgumentc��]UmP!)r��
repr_countrZs&r�__init__�PPosixTests.test_no_repr_is_called_on_signal_handler.<locals>.MyArgument.__init__ls	��"#��rc�T:�U9O]*
tm[RU_	2!��)rl�super�__repr__)r1�	__class__s&�rrs�PPosixTests.test_no_repr_is_called_on_signal_handler.<locals>.MyArgument.__repr__os������1�$���w�'�)�)rrk)	r@r<rArBrmrsrCrD�
__classcell__)rtrFs@@r�
MyArgumentriks����
$�
*�
*rrw)r*rlrSrrcr)rrX)r1rwrR�handlerrds&    r�(test_no_repr_is_called_on_signal_handler�3PosixTests.test_no_repr_is_called_on_signal_handlerhs���	*�	*��<������H�/�/�0��2�2�8�<���m�m�F�M�M�7�3�����c�6�?�?�3�����)�)�&�-�-�8�'�B��
�
�f�m�m�S�)�����)�)�&�-�-�8�#�>�����H�/�/�0r�netbsdz/gh-124083: strsignal is not supported on NetBSDc�@�UOQ[O[O22UOQ[O[O22UOQ[O[O
22P!)�	Interrupt�
Terminated�Hangup)�assertInrrY�SIGINT�SIGTERMrcrZs&r�test_strsignal�PosixTests.test_strsignal~s[��	
�
�
�k�6�#3�#3�F�M�M�#B�C��
�
�l�F�$4�$4�V�^�^�$D�E��
�
�h�� 0� 0���� ?�@rc��[OO[2o[OO	UQ2o[U2P!)zsignalinterproctester.py)�os�path�dirname�__file__�joinr)r1r��scripts&  r�test_interprocess_signal�#PosixTests.test_interprocess_signal�s1���'�'�/�/�(�+�������g�'A�B���� r�
valid_signalszrequires signal.valid_signalsc	� �[O2oUOU[2UO	[O
OU2UO	[O
OU2UO]U2UO[OU2UO[U2[O2[[2FD�oUOQ2%fJUQ7cJ%UOUQ59^tt^2[[U2oUO!U]2UOU[O2PPP2J�	P!)%fhJ�9h)rrr>r
r )rr�r)�setr�rr��SIGALRM�assertNotIn�NSIG�
assertLess�lenr'r�subTestr(�assertGreaterEqual)r1�sr�signums&   r�test_valid_signals�PosixTests.test_valid_signals�s
��

� � �"�����a��%��
�
�f�n�n�+�+�Q�/��
�
�f�n�n�,�,�a�0�����A��������a�(�����A�����,���K�D��?�?�5�)�)���-�-�����4��(�(� ���.���'�'���2��������4�)�(�
 �)�(�(�s�+AE<	�<F

�F

�sys.executable required.c��[O[OQQ,[OQ5oUOQUO2UOUO[O'2P!)z+KeyboardInterrupt triggers exit via SIGINT.�-czaimport os, signal, time
os.kill(os.getpid(), signal.SIGINT)
for _ in range(999): time.sleep(0.01)��stderr�KeyboardInterrupt)�
subprocess�runr+�
executable�PIPEr�r�r*�
returncoderr�)r1�processs& r�!test_keyboard_interrupt_exit_code�,PosixTests.test_keyboard_interrupt_exit_code�s_���.�.�����9�:�"���(��	
�
�
�*�G�N�N�;�����+�+�f�m�m�^�<rr!)r@r<rArBrMrSr[r`rery�unittest�skipIfr+r,rr�r��
skipUnless�hasattrrr�r�r�requires_subprocessr�rCrDrEs@rrHrHLs�����
�H�>�0�?�1�,�_�_�S�\�\�,�,�X�6�F�H�A�H�A�!�
������(�'��5�	�5�,������)C�D�� � �"�	=�#�E�	=rrHzWindows specificc�`�\sQs]�snQsQs\O\OQ2\
O2Q22sQs
UsP!)�WindowsSignalTestsc��[O2oUOU[2UO	[U2]2UO
[OOU2UO]U2UO[OU2UO[U2[O2P!)�)rr�r)r�r�r�r�rr�r�r�r��r1r�s& rr��%WindowsSignalTests.test_valid_signals�s���� � �"�����a��%�����A���*��
�
�f�n�n�+�+�Q�/�����A��������a�(�����A�����,rc	��Qo[2o[O[O[O[O
[O[O[O1FDYo[OU2eJ[OU[OV122UOU2J[	UOU2UO[29^tt^2[OPU2PPP2UO[29^tt^2[O]U2PPP2P!)%fhKO9h)%fhP!9h)c��P!rJr!)�x�ys&&rr�3WindowsSignalTests.test_issue9324.<locals>.<lambda>�s��tr)r�r�SIGABRT�SIGBREAK�SIGFPE�SIGILLr��SIGSEGVr�rX�add�
assertTruerVrW)r1rx�checkedr2s&   r�test_issue9324�!WindowsSignalTests.test_issue9324�s���#���%���N�N�F�O�O�V�]�]��M�M�6�=�=�&�.�.��N�N�$�C�
����$�0��
�
�c�6�=�=��#>�?����C� �$�	
���� �
�
�
�z�
*�
*��M�M�"�g�&�+��
�
�z�
*�
*��M�M�!�W�%�+�
*�+�
*��+�
*�
*�s$�E%�E8�%E5	�.E5	�8F		�F		r�c���[O[OQQ,[OQ5oUOQUO2QoUOUOU2P!)z?KeyboardInterrupt triggers an exit using STATUS_CONTROL_C_EXIT.r�zraise KeyboardInterruptr�r�l:)	r�r�r+r�r�r�r�r*r�)r1r��STATUS_CONTROL_C_EXITs&  rr��4WindowsSignalTests.test_keyboard_interrupt_exit_code�sZ���.�.�����'@�A�!���(��	
�
�
�*�G�N�N�;� *������+�+�-B�Crr!)r@r<rArBr�r�r�r�r+r�rr�r�rCrDrEs@rr�r��sI����-�&�*������)C�D�� � �"�D�#�E�Drr�c�`�\sQs]�snQsQs\O\OQ2Q2s
\O\\Q2Q2Q2s
\O\OQ2Q2s\O\O"Q	6HQ
2\O\\Q2Q2Q22sQsUsP!)
�
WakeupFDTestsc��UO[29^tt^2[O[OQ5PPP2UO[29^tt^2[O[OP
2PPP2P!)%fhK]9h)%fhP!9h))r�)rVr^r�
set_wakeup_fdr�rZs&r�test_invalid_call�WakeupFDTests.test_invalid_call�sn��
�
�
�y�
)�
)�� � ��
�
�6�*��
�
�y�
)�
)�� � �����6�*�
)�	*�
)��*�
)�
)�s#�&B�*&B-�B*	�#B*	�-B>	�6B>	c��[O2oUO[[1[
OU2P!rJ)r�make_bad_fdrVrW�OSErrorrr�)r1�fds& r�test_invalid_fd�WakeupFDTests.test_invalid_fd�s0��
�
"�
"�
$�����:�w�/� �.�.��	4rzneeds working sockets.c���[O2oUO2oUO2UO[[
1[OU2P!rJ)�socket�fileno�closerVrWr�rr�)r1�sockr�s&  r�test_invalid_socket�!WakeupFDTests.test_invalid_socket�sA���}�}���
�[�[�]���
�
�����:�w�/� �.�.��	4r�pipe�requires os.pipe()c��[O2vqUO[OU2UO[OU2[O2vq4UO[OU2UO[OU2[	[Q2%c/[O
UP
2[O
UP
2[OU2UO[OU2U2UO[OP2U2UO[OP2P2P!)�set_blocking)	r�r��
addCleanupr�r�r�rr�r*)r1�r1�w1�r2�w2s&    r�test_set_wakeup_fd_result�'WakeupFDTests.test_set_wakeup_fd_results���������������"�%�������"�%�������������"�%�������"�%��2�~�&�&��O�O�B��&��O�O�B��&����R� �����-�-�b�1�2�6�����-�-�b�1�2�6�����-�-�b�1�2�6rc�\�[O2oUOUO2UOP
2UO	2o[O2oUOUO2UOP
2UO	2o[
OU2UO[
OU2U2UO[
OP2U2UO[
OP2P2P!�F)r�r�r��setblockingr�rr�r*)r1�sock1�fd1�sock2�fd2s&    r� test_set_wakeup_fd_socket_result�.WakeupFDTests.test_set_wakeup_fd_socket_results����
�
���������$�
���%� ��l�l�n���
�
���������$�
���%� ��l�l�n�����S�!�����-�-�c�2�C�8�����-�-�b�1�3�7�����-�-�b�1�2�6rrztests specific to POSIXc�`�[O2vqUO[OU2UO[OU2[OUP	2UO[29^tt^2o[OU2PPP2UO[WO2QU*2[OUP
2[OU2[OP2P!)%fhK�9h)Tz&the fd %s must be in non-blocking mode)r�r�r�r�r�rVrWrr�r*�str�	exception)r1�rfd�wfd�cms&   r�test_set_wakeup_fd_blocking�)WakeupFDTests.test_set_wakeup_fd_blocking%s����7�7�9���������#�&�������#�&�	����T�"�
�
�
�z�
*�
*�b�� � ��%�+�����R�\�\�*�A�C�G�	I�	����U�#����S�!����R� �+�
*�s�
D�D-	�&D-	r!)r@r<rArBr�r�r�r�r�has_socket_supportr�r�r�r�r�r�r+r,r�rCrDrEs@rr�r��s�����7�4�
����3�3�5M�N�4�O�4������V�,�.B�C�7�D�7�"����3�3�5M�N�7�O�7�$�_�_�S�\�\�W�,�.G�H�
�����V�,�.B�C�!�D�I�!rr�c�,`�\sQsQsn\O
\PIQ2QP	-Qk2s\O
\PIQ2\O\	\
Q2Q2\Q222sQs
Q	sQ
s\O\	\Q2Q2Q
2sQsUsP!)�WakeupSignalTests�9�need _testcapi�orderedc�r�QO[[[U22V!2o[	QU2P!)aif 1:
        import _testcapi
        import os
        import signal
        import struct

        signals = {!r}

        def handler(signum, frame):
            pass

        def check_signum(signals):
            data = os.read(read, len(signals)+1)
            raised = struct.unpack('%uB' % len(data), data)
            if not {!r}:
                raised = set(raised)
                signals = set(signals)
            if raised != signals:
                raise Exception("%r != %r" % (raised, signals))

        {}

        signal.signal(signal.SIGALRM, handler)
        read, write = os.pipe()
        os.set_blocking(write, False)
        signal.set_wakeup_fd(write)

        test()
        check_signum(signals)

        os.close(read)
        os.close(write)
        r�)�format�tuple�map�intr)r1�	test_bodyr��signals�codes&&$* r�check_wakeup�WakeupSignalTests.check_wakeup;s5�� �@
�F�5��S�'�*�+�W�@�A	
�D	��t�$rr�r�c��Qo[O2vq#[OUQ2UOQ2[O
U2[O
U2[
QU2P![cKGh9h[O
S2[O
S2h9h)a'if 1:
        import _testcapi
        import errno
        import os
        import signal
        import sys
        from test.support import captured_stderr

        def handler(signum, frame):
            1/0

        signal.signal(signal.SIGALRM, handler)
        r, w = os.pipe()
        os.set_blocking(r, False)

        # Set wakeup_fd a read-only file descriptor to trigger the error
        signal.set_wakeup_fd(r)
        try:
            with captured_stderr() as err:
                signal.raise_signal(signal.SIGALRM)
        except ZeroDivisionError:
            # An ignored exception should have been printed out on stderr
            err = err.getvalue()
            if ('Exception ignored while trying to write to the signal wakeup fd'
                not in err):
                raise AssertionError(err)
            if ('OSError: [Errno %d]' % errno.EBADF) not in err:
                raise AssertionError(err)
        else:
            raise AssertionError("ZeroDivisionError not raised")

        os.close(r)
        os.close(w)
        �xz9OS doesn't report write() error on the read end of a piper�)r�r��write�skipTestr�r�r)r1r�r�ws&   r�test_wakeup_write_error�)WakeupSignalTests.test_wakeup_write_errorbs���!��D�w�w�y���	��H�H�Q���
�M�M�U�V��H�H�Q�K��H�H�Q�K���t�$���	��	��

�H�H�Q�K��H�H�Q�K�s.�A>�B�>	B�B�	B�B�B�.B=c�H�UOQ[O2P!)a�def test():
            import select
            import time

            TIMEOUT_FULL = 10
            TIMEOUT_HALF = 5

            class InterruptSelect(Exception):
                pass

            def handler(signum, frame):
                raise InterruptSelect
            signal.signal(signal.SIGALRM, handler)

            signal.alarm(1)

            # We attempt to get a signal during the sleep,
            # before select is called
            try:
                select.select([], [], [], TIMEOUT_FULL)
            except InterruptSelect:
                pass
            else:
                raise Exception("select() was not interrupted")

            before_time = time.monotonic()
            select.select([read], [], [], TIMEOUT_FULL)
            after_time = time.monotonic()
            dt = after_time - before_time
            if dt >= TIMEOUT_HALF:
                raise Exception("%s >= %s" % (dt, TIMEOUT_HALF))
        �rrr�rZs&r�test_wakeup_fd_early�&WakeupSignalTests.test_wakeup_fd_early�s������>�^�^�?	rc�H�UOQ[O2P!)a`def test():
            import select
            import time

            TIMEOUT_FULL = 10
            TIMEOUT_HALF = 5

            class InterruptSelect(Exception):
                pass

            def handler(signum, frame):
                raise InterruptSelect
            signal.signal(signal.SIGALRM, handler)

            signal.alarm(1)
            before_time = time.monotonic()
            # We attempt to get a signal during the select call
            try:
                select.select([read], [], [], TIMEOUT_FULL)
            except InterruptSelect:
                pass
            else:
                raise Exception("select() was not interrupted")
            after_time = time.monotonic()
            dt = after_time - before_time
            if dt >= TIMEOUT_HALF:
                raise Exception("%s >= %s" % (dt, TIMEOUT_HALF))
        rrZs&r�test_wakeup_fd_during�'WakeupSignalTests.test_wakeup_fd_during�s������6�^�^�7	rc�f�UOQ[O[O2P!)z�def test():
            signal.signal(signal.SIGUSR1, handler)
            signal.raise_signal(signal.SIGUSR1)
            signal.raise_signal(signal.SIGALRM)
        )rrr_r�rZs&r�test_signum�WakeupSignalTests.test_signum�s$�������^�^�V�^�^�		-r�pthread_sigmask�need signal.pthread_sigmask()c�j�UOQ[O[OP
Q5P!)a�def test():
            signum1 = signal.SIGUSR1
            signum2 = signal.SIGUSR2

            signal.signal(signum1, handler)
            signal.signal(signum2, handler)

            signal.pthread_sigmask(signal.SIG_BLOCK, (signum1, signum2))
            signal.raise_signal(signum1)
            signal.raise_signal(signum2)
            # Unblocking the 2 signals calls the C signal handler twice
            signal.pthread_sigmask(signal.SIG_UNBLOCK, (signum1, signum2))
        )r�)rrr_�SIGUSR2rZs&r�test_pending�WakeupSignalTests.test_pending�s-��	
�����n�n�f�n�n�e�	�	=rr!)r@r<rArBr�r��	_testcapirr�r�r�rrrrrrrrCrDrEs@rr�r�9s�����
�_�_�Y�$�&�(8�9�$%��$%�:�$%�L�_�_�Y�$�&�(8�9�
�����V�,�.B�C��1%��D�:�1%�f �D�<-������):�;�8�:�
=�:�
=rr��
socketpairzneed socket.socketpairc��`�\sQsQsn\O
\PIQ2Q2s\O
\PIQ2Q2s\O
\PIQ2Q2s	Qs
UsP!)�WakeupSocketSignalTests��r�c�$�Qo[QU2P!)a�if 1:
        import signal
        import socket
        import struct
        import _testcapi

        signum = signal.SIGINT
        signals = (signum,)

        def handler(signum, frame):
            pass

        signal.signal(signum, handler)

        read, write = socket.socketpair()
        write.setblocking(False)
        signal.set_wakeup_fd(write.fileno())

        signal.raise_signal(signum)

        data = read.recv(1)
        if not data:
            raise Exception("no signum written")
        raised = struct.unpack('B', data)
        if raised != signals:
            raise Exception("%r != %r" % (raised, signals))

        read.close()
        write.close()
        r��r�r1rs& r�test_socket�#WakeupSocketSignalTests.test_socket�s����>	��t�$rc�x�[OQ6XcQoLQoQOUQ5o[QU2P!)�nt�sendra,if 1:
        import errno
        import signal
        import socket
        import sys
        import time
        import _testcapi
        from test.support import captured_stderr

        signum = signal.SIGINT

        def handler(signum, frame):
            pass

        signal.signal(signum, handler)

        read, write = socket.socketpair()
        read.setblocking(False)
        write.setblocking(False)

        signal.set_wakeup_fd(write.fileno())

        # Close sockets: send() will fail
        read.close()
        write.close()

        with captured_stderr() as err:
            signal.raise_signal(signum)

        err = err.getvalue()
        if ('Exception ignored while trying to {action} to the signal wakeup fd'
            not in err):
            raise AssertionError(err)
        ��actionr��r�rr�r�r1r,rs&  r�test_send_error�'WakeupSocketSignalTests.test_send_errors@���7�7�d�?��F��F�!�B
�F�&�F�!�C	
�D	��t�$rc�x�[OQ6XcQoLQoQOUQ5o[QU2P!)r)r*raK
if 1:
        import errno
        import signal
        import socket
        import sys
        import time
        import _testcapi
        from test.support import captured_stderr

        signum = signal.SIGINT

        # This handler will be called, but we intentionally won't read from
        # the wakeup fd.
        def handler(signum, frame):
            pass

        signal.signal(signum, handler)

        read, write = socket.socketpair()

        # Fill the socketpair buffer
        if sys.platform == 'win32':
            # bpo-34130: On Windows, sometimes non-blocking send fails to fill
            # the full socketpair buffer, so use a timeout of 50 ms instead.
            write.settimeout(0.050)
        else:
            write.setblocking(False)

        written = 0
        if sys.platform == "vxworks":
            CHUNK_SIZES = (1,)
        else:
            # Start with large chunk size to reduce the
            # number of send needed to fill the buffer.
            CHUNK_SIZES = (2 ** 16, 2 ** 8, 1)
        for chunk_size in CHUNK_SIZES:
            chunk = b"x" * chunk_size
            try:
                while True:
                    write.send(chunk)
                    written += chunk_size
            except (BlockingIOError, TimeoutError):
                pass

        print(f"%s bytes written into the socketpair" % written, flush=True)

        write.setblocking(False)
        try:
            write.send(b"x")
        except BlockingIOError:
            # The socketpair buffer seems full
            pass
        else:
            raise AssertionError("%s bytes failed to fill the socketpair "
                                 "buffer" % written)

        # By default, we get a warning when a signal arrives
        msg = ('Exception ignored while trying to {action} '
               'to the signal wakeup fd')
        signal.set_wakeup_fd(write.fileno())

        with captured_stderr() as err:
            signal.raise_signal(signum)

        err = err.getvalue()
        if msg not in err:
            raise AssertionError("first set_wakeup_fd() test failed, "
                                 "stderr: %r" % err)

        # And also if warn_on_full_buffer=True
        signal.set_wakeup_fd(write.fileno(), warn_on_full_buffer=True)

        with captured_stderr() as err:
            signal.raise_signal(signum)

        err = err.getvalue()
        if msg not in err:
            raise AssertionError("set_wakeup_fd(warn_on_full_buffer=True) "
                                 "test failed, stderr: %r" % err)

        # But not if warn_on_full_buffer=False
        signal.set_wakeup_fd(write.fileno(), warn_on_full_buffer=False)

        with captured_stderr() as err:
            signal.raise_signal(signum)

        err = err.getvalue()
        if err != "":
            raise AssertionError("set_wakeup_fd(warn_on_full_buffer=False) "
                                 "test failed, stderr: %r" % err)

        # And then check the default again, to make sure warn_on_full_buffer
        # settings don't leak across calls.
        signal.set_wakeup_fd(write.fileno())

        with captured_stderr() as err:
            signal.raise_signal(signum)

        err = err.getvalue()
        if msg not in err:
            raise AssertionError("second set_wakeup_fd() test failed, "
                                 "stderr: %r" % err)

        r+r�r-r.s&  r�test_warn_on_full_buffer�0WakeupSocketSignalTests.test_warn_on_full_bufferCsA���7�7�d�?��F��F�g�N
�F�&�F�!�O	
�P	��t�$rr!)r@r<rArBr�r�rr&r/r2rCrDrEs@rr!r!�sx�����_�_�Y�$�&�(8�9�!%�:�!%�F�_�_�Y�$�&�(8�9�(%�:�(%�T�_�_�Y�$�&�(8�9�n%�:�n%rr!�siginterruptzneeds signal.siginterrupt()r�r�c�~`�\sQsQsn\O
1QksQsQs\OQ2Q2s
QsUsP!)�SiginterruptTest�c��QU8Q0o[QU29^tt^2oUOO2oUOUQ5vqgVV*oUO	2oUQ7c[QU8QU802gU]6HttPPP2![OcSO2PPP2P
!h9h)%fhP!9h)z�Perform a read during which a signal will arrive.  Return True if the
read is interrupted by the signal and raises an exception.  Return False
if it returns normally.
zif 1:
            import errno
            import os
            import signal
            import sys

            interrupt = aq
            r, w = os.pipe()

            def handler(signum, frame):
                1 / 0

            signal.signal(signal.SIGALRM, handler)
            if interrupt is not None:
                signal.siginterrupt(signal.SIGALRM, interrupt)

            print("ready")
            sys.stdout.flush()

            # run the test twice
            try:
                for loop in range(2):
                    # send a SIGALRM in a second (during the read)
                    signal.alarm(1)
                    try:
                        # blocking call: read from a pipe without data
                        os.read(r, 1)
                    except ZeroDivisionError:
                        pass
                    else:
                        sys.exit(2)
                sys.exit(3)
            finally:
                os.close(r)
                os.close(w)
        r���timeout�Child error (exit code �): )��)	r	�stdout�readline�communicate�wait�	Exceptionr��TimeoutExpired�kill)	r1�	interruptr:rr��
first_liner?r��exitcodes	&&&      r�readpipe_interrupted�%SiginterruptTest.readpipe_interrupted�s���T�G#��H�$��
%�
%��
'�$�^�^�4�4�6�
�!(�!4�!4�W�!4�!E���
$�,��"�<�<�>���6�)�#�'/��%9�:�:� �A�
�&�
%���,�,�
������&�
%�
��
&�
%�
%�s@�C�.B�
C�,C�B?�"B?�3C�>B?�?C�C	�C	c�L�UOP2oUOU2P!rJ�rIr��r1�interrupteds& r�test_without_siginterrupt�*SiginterruptTest.test_without_siginterrupt�� ���/�/��5������$rc�L�UOP	2oUOU2P!�TrLrMs& r�test_siginterrupt_on�%SiginterruptTest.test_siginterrupt_on�rQr�walltimec�P�UOP
]Q5oUOU2P!)Fr9)rI�assertFalserMs& r�test_siginterrupt_off�&SiginterruptTest.test_siginterrupt_offs'��
�/�/��q�/�A������%rr!)
r@r<rArBr�
SHORT_TIMEOUTrIrOrT�requires_resourcerYrCrDrEs@rr6r6�s?����7>�6K�6K�:'�x%�%�
���z�*�&�+�&rr6�	getitimer�	setitimerz/needs signal.getitimer() and signal.setitimer()c�`�\sQsQsnQsQsQsQsQsQs	Qs
\O\
OQ79%f\Q	2Q
2sQsQsQ
sUsP!)�
ItimerTest�c��P
Um]UmPUm[O[OUO
2UmP!r�)�hndl_called�
hndl_count�itimerrr��sig_alrm�	old_alarmrZs&r�setUp�ItimerTest.setUps2�� ������������v�~�~�t�}�}�E��rc���[O[OUO2UOd$[OUO]2P!P!rJ)rr�rgrer^rZs&r�tearDown�ItimerTest.tearDowns;���
�
�f�n�n�d�n�n�5��;�;�"����T�[�[�!�,�#rc��P	UmP!rS)rcrKs&*rrf�ItimerTest.sig_alrms
����rc��P	UmUO]6�c[OQ2gUO]6Xc&[O[O
]2U9O]*
tmP!)Tz.setitimer didn't disable ITIMER_VIRTUAL timer.)rcrdr�ItimerErrorr^�ITIMER_VIRTUALrKs&*r�
sig_vtalrm�ItimerTest.sig_vtalrm!s^������?�?�Q���$�$�&��
�
�_�_��
!����V�2�2�A�6����1��rc�`�P	Um[O[O]2P!rS)rcrr^�ITIMER_PROFrKs&*r�sig_prof�ItimerTest.sig_prof.s ���������+�+�Q�/rc�h�UO[O[OP]2P!rp)rVrrpr^�ITIMER_REALrZs&r�test_itimer_exc�ItimerTest.test_itimer_exc2s'��	
���&�,�,�f�.>�.>��A�F�rc���[OUm[OUOQ2[O2UOUOP	2P!)��?)rryrer^�pauser*rcrZs&r�test_itimer_real�ItimerTest.test_itimer_real;sB���(�(���������c�*���������)�)�4�0rzDitimer not reliable (does not mix well with threading) on some BSDs.c�H�[OUm[O[OUO2[O
UOQQ2[O[O2FDEo[Q[Q222o[OUO2Q6XfJDL	UO[OUO2Q2UOUOP	2P!)���MbP?c3�>�SF �DpU*w�	J	P!3hrJr!��.0�is& r�	<genexpr>�1ItimerTest.test_itimer_virtual.<locals>.<genexpr>K���<���<�a��E�E�<���順��r�)rrqre�	SIGVTALRMrrr^r�
busy_retry�LONG_TIMEOUT�sum�ranger]r*rc�r1�_s& r�test_itimer_virtual�ItimerTest.test_itimer_virtualBs����+�+����
�
�f�&�&����8�������e�U�3��#�#�G�$8�$8�9�A��0�5��<�0�0�A�������,�
�:��:�	
����)�)�$�+�+�6�
�C�����)�)�4�0rc�H�[OUm[O[OUO2[O
UOQQ2[O[O2FDEo[Q[Q222o[OUO2Q6XfJDL	UO[OUO2Q2UOUOP	2P!)g�������?c3�>�SF �DpU*w�	J	P!3hrJr!r�s& rr��.ItimerTest.test_itimer_prof.<locals>.<genexpr>\r�r�r�r�)rrure�SIGPROFrvr^rr�r�r�r�r]r*rcr�s& r�test_itimer_prof�ItimerTest.test_itimer_profUs����(�(����
�
�f�n�n�d�m�m�4�������c�3�/��#�#�G�$8�$8�9�A��0�5��<�0�0�A�������,�
�:��:�	
����)�)�$�+�+�6�
�C�����)�)�4�0rc���[OUm[OUOQ2[O
]2UO
UOP	2P!����ư>)rryrer^�time�sleepr*rcrZs&r�test_setitimer_tiny�ItimerTest.test_setitimer_tinyfsF���(�(���������d�+��
�
�1�
�����)�)�4�0r)rcrdrerg)�netbsd5)r@r<rArBrhrkrfrrrvrzrr�r�r+r,rr�r�r�rCrDrEs@rr`r`sn����F�-� ��0�H�1��_�_�S�\�\�\�1�D�D�_�N�P�1�P�1�"1�"1�1rr`c�`�\sQsQsnQs\O\\Q2Q2Q2s	\O\\Q2Q2\O\\Q2Q2Q22s
\O\\Q	2Q
2\O2Q22s
\O\\Q2Q2Q2s\O\\Q
2Q2Q2s\O\\Q2Q2Q2s\O\\Q2Q2Q2s\O\\Q2Q2Q2s\O\\Q2Q2Q2s\O\\Q2Q2Q2s\O\\Q
2Q2\O\\Q2Q2\O2Q222s\O\\Q2Q2Q2s\O\\Q2Q2Q2s\O\\Q2Q2\O2Q22s\O\\Q	2Q
2\O2Q22sQsUsP!)�PendingSignalsTests�pzO
Test pthread_sigmask(), pthread_kill(), sigpending() and sigwait()
functions.
�
sigpendingzneed signal.sigpending()c�b�UO[O2[22P!rJ)r*rr�r�rZs&r�test_sigpending_empty�)PendingSignalsTests.test_sigpending_emptyus��	
����*�*�,�c�e�4rrrc�$�Qo[QU2P!)a
if 1:
            import os
            import signal

            def handler(signum, frame):
                1/0

            signum = signal.SIGUSR1
            signal.signal(signum, handler)

            signal.pthread_sigmask(signal.SIG_BLOCK, [signum])
            os.kill(os.getpid(), signum)
            pending = signal.sigpending()
            for sig in pending:
                assert isinstance(sig, signal.Signals), repr(pending)
            if pending != {signum}:
                raise Exception('%s != {%s}' % (pending, signum))
            try:
                signal.pthread_sigmask(signal.SIG_UNBLOCK, [signum])
            except ZeroDivisionError:
                pass
            else:
                raise Exception("ZeroDivisionError not raised")
        r�r$r%s& r�test_sigpending�#PendingSignalsTests.test_sigpendingzs��
��0	��t�$r�pthread_killzneed signal.pthread_kill()c�$�Qo[QU2P!)a�if 1:
            import signal
            import threading
            import sys

            signum = signal.SIGUSR1

            def handler(signum, frame):
                1/0

            signal.signal(signum, handler)

            tid = threading.get_ident()
            try:
                signal.pthread_kill(tid, signum)
            except ZeroDivisionError:
                pass
            else:
                raise Exception("ZeroDivisionError not raised")
        r�r$r%s& r�test_pthread_kill�%PendingSignalsTests.test_pthread_kill�s����(	��t�$rc�R�QUO28QU8Q0o[QU2P!)zW
test: body of the "def test(signum):" function.
blocked: number of the blocked signal
z�if 1:
        import signal
        import sys
        from signal import Signals

        def handler(signum, frame):
            1/0

        z

        blocked = a�
        signum = signal.SIGALRM

        # child: block and wait the signal
        try:
            signal.signal(signum, handler)
            signal.pthread_sigmask(signal.SIG_BLOCK, [blocked])

            # Do the tests
            test(signum)

            # The handler must not be called on unblock
            try:
                signal.pthread_sigmask(signal.SIG_UNBLOCK, [blocked])
            except ZeroDivisionError:
                print("the signal handler has been called",
                      file=sys.stderr)
                sys.exit(1)
        except BaseException as err:
            print("error: {}".format(err), file=sys.stderr)
            sys.stderr.flush()
            sys.exit(1)
        r�)�stripr)r1�blocked�testrs&&& r�wait_helper�PendingSignalsTests.wait_helper�s%��N�z�z�|�W�A &��J	��t�$r�sigwaitzneed signal.sigwait()c�H�UO[OQ2P!)a 
        def test(signum):
            signal.alarm(1)
            received = signal.sigwait([signum])
            assert isinstance(received, signal.Signals), received
            if received != signum:
                raise Exception('received %s, not %s' % (received, signum))
        �r�rr�rZs&r�test_sigwait� PendingSignalsTests.test_sigwait�s��	
������*�	
r�sigwaitinfozneed signal.sigwaitinfo()c�H�UO[OQ2P!)z�
        def test(signum):
            signal.alarm(1)
            info = signal.sigwaitinfo([signum])
            if info.si_signo != signum:
                raise Exception("info.si_signo != %s" % signum)
        r�rZs&r�test_sigwaitinfo�$PendingSignalsTests.test_sigwaitinfo����	
������*�	
r�sigtimedwaitzneed signal.sigtimedwait()c�H�UO[OQ2P!)z�
        def test(signum):
            signal.alarm(1)
            info = signal.sigtimedwait([signum], 10.1000)
            if info.si_signo != signum:
                raise Exception('info.si_signo != %s' % signum)
        r�rZs&r�test_sigtimedwait�%PendingSignalsTests.test_sigtimedwait�r�rc�H�UO[OQ2P!)z�
        def test(signum):
            import os
            os.kill(os.getpid(), signum)
            info = signal.sigtimedwait([signum], 0)
            if info.si_signo != signum:
                raise Exception('info.si_signo != %s' % signum)
        r�rZs&r�test_sigtimedwait_poll�*PendingSignalsTests.test_sigtimedwait_polls��	
������*�	
rc�H�UO[OQ2P!)z�
        def test(signum):
            received = signal.sigtimedwait([signum], 1.0)
            if received is not None:
                raise Exception("received=%r" % (received,))
        r�rZs&r�test_sigtimedwait_timeout�-PendingSignalsTests.test_sigtimedwait_timeouts��	
������*�	
rc�v�[OoUO[[OU,Q2P!)r}g�)rr�rVrWr�)r1r�s& r�"test_sigtimedwait_negative_timeout�6PendingSignalsTests.test_sigtimedwait_negative_timeouts)���������*�f�&9�&9�F�8�T�Jrc� �[QQ2P!)r�a�if True:
            import os, threading, sys, time, signal

            # the default handler terminates the process
            signum = signal.SIGUSR1

            def kill_later():
                # wait until the main thread is waiting in sigwait()
                time.sleep(1)
                os.kill(os.getpid(), signum)

            # the signal must be blocked by all the threads
            signal.pthread_sigmask(signal.SIG_BLOCK, [signum])
            killer = threading.Thread(target=kill_later)
            killer.start()
            received = signal.sigwait([signum])
            if received != signum:
                print("sigwait() received %s, not %s" % (received, signum),
                      file=sys.stderr)
                sys.exit(1)
            killer.join()
            # unblock the signal, which should have been cleared by sigwait()
            signal.pthread_sigmask(signal.SIG_UNBLOCK, [signum])
        r$rZs&r�test_sigwait_thread�'PendingSignalsTests.test_sigwait_thread s��	�� �	
rc��UO[[O2UO[[O]2UO[[O]]]2UO[[OQ,2UO[
29^tt^2[O[O[O,2PPP2UO[
29^tt^2[O[O],2PPP2UO[
29^tt^2[O[O]Q*,2PPP2P!)%fhK�9h)%fhKx9h)%fhP!9h)rqi���)rVr^rrr�rWr$r�rZs&r�test_pthread_sigmask_arguments�2PendingSignalsTests.test_pthread_sigmask_argumentsCs��	
���)�V�%;�%;�<����)�V�%;�%;�Q�?����)�V�%;�%;�Q��1�E����'�6�#9�#9�4��D�
�
�
�z�
*�
*��"�"�6�#3�#3�f�k�k�]�C�+�
�
�
�z�
*�
*��"�"�6�#3�#3�a�S�9�+�
�
�
�z�
*�
*��"�"�6�#3�#3�a��g�Y�?�+�
*�	+�
*��
*�
*��
*�
*�
*�s6�55F�'F&�.F9�F#	�F#	�&F6	�/F6	�9G
	�G
	c��[O[O[O22oUO	[O[O
U2[O[O[O22oUOU[O22P!rJ)rrr$r�r�r&r%�assertLessEqualr�s& r�"test_pthread_sigmask_valid_signals�6PendingSignalsTests.test_pthread_sigmask_valid_signalsQs{��
�"�"�6�#3�#3�V�5I�5I�5K�L������.�.��0B�0B�A�F��"�"�6�#5�#5�v�7K�7K�7M�N�����Q�� 4� 4� 6�7rc�$�Qo[QU2P!)a-	if 1:
        import signal
        import os; import threading

        def handler(signum, frame):
            1/0

        def kill(signum):
            os.kill(os.getpid(), signum)

        def check_mask(mask):
            for sig in mask:
                assert isinstance(sig, signal.Signals), repr(sig)

        def read_sigmask():
            sigmask = signal.pthread_sigmask(signal.SIG_BLOCK, [])
            check_mask(sigmask)
            return sigmask

        signum = signal.SIGUSR1

        # Install our signal handler
        old_handler = signal.signal(signum, handler)

        # Unblock SIGUSR1 (and copy the old mask) to test our signal handler
        old_mask = signal.pthread_sigmask(signal.SIG_UNBLOCK, [signum])
        check_mask(old_mask)
        try:
            kill(signum)
        except ZeroDivisionError:
            pass
        else:
            raise Exception("ZeroDivisionError not raised")

        # Block and then raise SIGUSR1. The signal is blocked: the signal
        # handler is not called, and the signal is now pending
        mask = signal.pthread_sigmask(signal.SIG_BLOCK, [signum])
        check_mask(mask)
        kill(signum)

        # Check the new mask
        blocked = read_sigmask()
        check_mask(blocked)
        if signum not in blocked:
            raise Exception("%s not in %s" % (signum, blocked))
        if old_mask ^ blocked != {signum}:
            raise Exception("%s ^ %s != {%s}" % (old_mask, blocked, signum))

        # Unblock SIGUSR1
        try:
            # unblock the pending signal calls immediately the signal handler
            signal.pthread_sigmask(signal.SIG_UNBLOCK, [signum])
        except ZeroDivisionError:
            pass
        else:
            raise Exception("ZeroDivisionError not raised")
        try:
            kill(signum)
        except ZeroDivisionError:
            pass
        else:
            raise Exception("ZeroDivisionError not raised")

        # Check the new mask
        unblocked = read_sigmask()
        if signum in unblocked:
            raise Exception("%s in %s" % (signum, unblocked))
        if blocked ^ unblocked != {signum}:
            raise Exception("%s ^ %s != {%s}" % (blocked, unblocked, signum))
        if old_mask != unblocked:
            raise Exception("%s != %s" % (old_mask, unblocked))
        r�r$r%s& r�test_pthread_sigmask�(PendingSignalsTests.test_pthread_sigmaskZs��G��P	��t�$rc���Qo[QU29^tt^2oUO2vq4UO2oU]6wc[QU8QU802gPPP2P!)%fhP!9h)a7if True:
            import threading
            import signal
            import sys

            def handler(signum, frame):
                sys.exit(3)

            signal.signal(signal.SIGUSR1, handler)
            signal.pthread_kill(threading.get_ident(), signal.SIGUSR1)
            sys.exit(2)
        r�r;r<)r	rArBrC)r1rr�r?r�rHs&     r�test_pthread_kill_main_thread�1PendingSignalsTests.test_pthread_kill_main_thread�sg�����$��
%�
%��$�0�0�2�N�F��|�|�~�H��1�}��!)�6�!3�4�4��&�
%�
%�
%�s�)A �A � A1	�)A1	r!)r@r<rArB�__doc__r�r�r�rr�r�r�requires_working_threadingr�r�r�r�r�r�r�r�r�r�r�r�r�rCrDrEs@rr�r�ps�����������6�3�5�5�5�5������):�;�8�:�
������6�3�5�%�5�:�%�6������8�5�7��0�0�2�%�3�7�%�.�����):�;�8�:�*%�:�*%�X������3�0�2�
�2�
�������7�4�6�
�6�
�������8�5�7�
�7�
�������8�5�7�	
�7�	
�������8�5�7�
�7�
�������8�5�7�K�7�K�������3�0�2�
�����):�;�8�:��0�0�2�
�3�:�2�

�<�����):�;�8�:�
@�:�
@������):�;�8�:�8�:�8������):�;�8�:��0�0�2�I%�3�:�I%�V������8�5�7��0�0�2�4�3�7�4rr�c�v`�\sQsQsnQsQsQsQs\O\
\Q2Q2Q2s\O\
\Q2Q2Q	2s
\OQ
2\O \Q2\O\
\Q2Q
2\O&2Q2222sQsUsP!)�
StressTesti�z�
Stress signal delivery, especially when a signal arrives in
the middle of recomputing the signal state or executing
previously tripped signal handlers.
c�t�[OV2oUO[OV2P!rJ)rr�)r1r�rx�old_handlers&&& r�setsig�StressTest.setsig�s"���m�m�F�4������
�
�v�;rc�8``�]n,nQUU1QkkoUO[O[O]2UO	[O
U2U2[
R2R6c[OQ2J([[
R2]*
2Tt,tFD!oRU]**RU**
MJ#	oo[OU2o[O%c[QU1*2U!ttoh)�c�:�[R2R6cLRO[O22[O
[OQ2P!P!r�)r��appendr��perf_counterrr^ry)r��frame�N�timess&&��rrx�5StressTest.measure_itimer_resolution.<locals>.handler�s@����5�z�A�~����T�.�.�0�1�� � ��!3�!3�T�:�rr�z,detected median itimer() resolution: %.6f s.�NN)r�rr^ryr�r�r�r�r�r��
statistics�medianr�verbose�print)r1rxr��	durations�medr�r�s&    @@r�measure_itimer_resolution�$StressTest.measure_itimer_resolution�s��������	;�	;�	
����(�(�&�*<�*<�a�@����F�N�N�G�,��	��%�j�1�n��J�J�t��49�#�e�*�q�.�4I�J�4I�q�U�1�Q�3�Z�%��(�*�*�4I�	�J����	�*���?�?�?��@�C�6�I�J��
��	Ks�+)Dc�~�UO2oUQ6:cQ!UQ6:c]d!UOQU1*2P!)g-C��6?i'g{�G�z�?z^detected itimer resolution (%.3f s.) too high (> 10 ms.) on this platform (or system too busy))r�r	)r1�resos& r�decide_itimer_count�StressTest.decide_itimer_count�sB���-�-�/���4�<��
�T�\���M�M�M�!�G�$�
%rr^ztest needs setitimer()c�`�UO2o,nQoQU1QkkoUO[OU2UO[OU2UO[O
U2]o[O2[O*oVA6Cc[O[O2[O2U]*
o[R2U6c3[O2U6c[OQ2JB[O[O2[O2U]*
o[R2U6fJ�[O2U6fJ�[OQ2JFUO[R2UQ2P!)z+
This test uses dependent signal handlers.
c��[O[OQ[O2Q**2P!)r���h㈵��>)rr^ry�random)r�r�s&&r�
first_handler�@StressTest.test_stress_delivery_dependent.<locals>.first_handler�s*��
���V�/�/���
�
��$�8N�1N�Orc�,:�ROU2P!rJ�r��r�r��sigss&&�r�second_handler�AStressTest.test_stress_delivery_dependent.<locals>.second_handler�����K�K��rr�Some signals were lostr�)r�r�rr�r_r�r��	monotonicrr[r�rE�getpidr�r�r*)r1r�rr	�
expected_sigs�deadliners&     @r�test_stress_delivery_dependent�)StressTest.test_stress_delivery_dependent�s&���
�$�$�&����	P�	 �	
���F�N�N�M�2����F�N�N�M�2����F�N�N�N�3��
��>�>�#�g�&;�&;�;�����G�G�B�I�I�K����0��Q��M��d�)�m�+����0@�8�0K��
�
�4� ��G�G�B�I�I�K����0��Q��M��d�)�m�+����0@�8�0K��
�
�4� �	
����T��A�'?�@rc�`�UO2o,nU1QkoUO[OU2UO[OU2]oV16c�[O
[OQ[O2Q**2[O[O2[O2U]*
o[O[O2FDo[R2U6�fJJ�	J�UO[R2UQ2P!)z.
This test uses simultaneous signal handlers.
c�,:�ROU2P!rJrrs&&�rrx�=StressTest.test_stress_delivery_simultaneous.<locals>.handler+rrr�rr)r�r�rrr�r^ryrr�rErr�sleeping_retryr[r�r*)r1r�rxrr�rs&    @r�!test_stress_delivery_simultaneous�,StressTest.test_stress_delivery_simultaneous"s����
�$�$�&����	 �	
���F�N�N�G�,����F�N�N�G�,��
���
���V�/�/���
�
��$�8N�1N�O��G�G�B�I�I�K����0��Q��M��+�+�G�,A�,A�B���t�9�
�-��C�	
����T��A�'?�@rz/gh-121065: test is flaky on free-threaded buildz&crashes due to system bug (FB13453490)r_ztest needs SIGUSR1c�Z```	`
`�[On]n
]n	P
nU	1QknUU
U1QkoUU	U
U1Qko[ORR2oUO[ORU2[OUQ5oP
o[
O29^tt^2oUO2U2P	nUO2UOdaUOUOO[2UOQRQ
Q0[UOO22P	oPPP2U%fUOR	]2UO!R	R
2P	nUO2P!)%fhKP9hP	nSO2h9h)rc�:�R]*
nP!rpr!)r�r��num_received_signalss&&�r�custom_handler�AStressTest.test_stress_modifying_handlers.<locals>.custom_handlerQs��� �A�%� rc�\:�R%f"[OR2R]*
nJ)P!rp)r�raise_signal)�do_stop�num_sent_signalsr�s���r�set_interrupts�AStressTest.test_stress_modifying_handlers.<locals>.set_interruptsUs$�����#�#�F�+� �A�%� �rc�:�R]d6fR]6cG[Q2FD4oR[O1FDo[ORU2J	J6	JTP!)�di N)r�rr )r�rxrrr!r�s  ����r�cycle_handlers�AStressTest.test_stress_modifying_handlers.<locals>.cycle_handlers[sI���"�S�(�,@�1�,D��u��A�$2�F�N�N�#C���
�
�f�g�6�$D�&�-Er)�targetzSignal �dz ignored due to race condition)rr_r��	threading�Threadr�catch_unraisable_exception�startr��
unraisabler)�	exc_valuer�r�r��
assertGreaterr�)r1r"r&r��t�ignoredr�rr rr!r�s&      @@@@@r�test_stress_modifying_handlers�)StressTest.test_stress_modifying_handlersEsP��������� ����	&�	&�	7�	7��m�m�F�N�;������
�
�v�{�;����N�3��	��G��3�3�5�5�����	�� ��������=�=�,��)�)�"�-�-�*A�*A�7�K��M�M�!�&���+I�J��B�M�M�3�3�4�6�#�G�6�$��"�"�#7��;�� � �!5�7G�H��G�
�F�F�H�16�5��.�G�
�F�F�H�s7�F�#7F�A F�;F�$F�F	�F	�F�F*r!)r@r<rArBr�r�r�r�r�r�r�rrrr�requires_gil_enabledr�rrr�r3rCrDrEs@rr�r��s������<��0%�������5�1�3�*A�3�*A�X������5�1�3�A�3�A�B
�!�!�"S�T�
�_�_�X�G�H�
������3�-�/��0�0�2�6�3�/�I�U�
6rr�c�`�\sQsQsnQs\O\OQ6gQ2Q2s	Qs
QsQsUs
P!)	�RaiseSignalTesti�c���UO[29^tt^2[O[O2PPP2P!)%fhP!9hrJ)rV�KeyboardInterruptrrr�rZs&r�test_sigint�RaiseSignalTest.test_sigint�s5��
�
�
�0�
1�
1�����
�
�.�2�
1�
1�
1�s�%A�A	�A	rzWindows specific testc���]o[OU2UOQ2P![c,oSO[O
6XcPo=P!gPo=hh9h)rqz#OSError (Invalid argument) expected)rr�failr��errno�EINVAL)r1rc�es&  r�test_invalid_argument�%RaiseSignalTest.test_invalid_argument�sM��	��F�����'��I�I�;�<���	��w�w�%�,�,�&����		�s�).�	A$�A$�A�A�A$c�,`�P
nU1Qko[O[OU2oUO[O[OU2[O[O2UO	R2P!)Fc�:�P	nP!rSr!)�a�b�is_oks&&�rrx�-RaiseSignalTest.test_handler.<locals>.handler�s����Er)rr�r�rr�)r1rx�
old_signalrGs&  @r�test_handler�RaiseSignalTest.test_handler�sY�����	��]�]�6�=�=�'�:�
�����
�
�v�}�}�j�A����F�M�M�*�����rc�N�Qo[QU2vq#oUOQU2P!)z�if 1:
        import _thread
        class Foo():
            def __del__(self):
                _thread.interrupt_main()

        x = Foo()
        r�s/OSError: Signal 2 ignored due to race condition)rr�)r1r�rc�out�errs&    r�test__thread_interrupt_main�+RaiseSignalTest.test__thread_interrupt_main�s*����(��d�3�����
�
�H�#�Nrr!)r@r<rArBr:r�r�r+r,rArJrPrCrDrEs@rr7r7�sE����/��_�_�S�\�\�W�,�.E�F�	�G�	�	�O�Orr7c�b`�\sQsQsn\O
\\Q2Q2Q2sQs	Us
P!)�PidfdSignalTesti��pidfd_send_signalzpidfd support not built inc�^�UO[29^tt^2o[O][O2PPP2WO
O[O6XcUOQ2L:UO
O[O6XcUOQ2UOUO
O[O2[OQ[O20[O2oUO![O"U2UO%[&Q29^tt^2[OU[O[)2]2PPP2UO[*29^tt^2[OU[O2PPP2P!)%fhCK�9h)%fhKq9h)%fhP!9h)rzkernel does not support pidfdsz"Not enough privileges to use pidfsz/proc/z^siginfo must be None$)rVr�rrTr�r�r>�ENOSYSr	�EPERMr*�EBADFr��openr�O_DIRECTORYr�r��assertRaisesRegexr^�objectr9)r1r��my_pidfds&  r�test_pidfd_send_signal�&PidfdSignalTest.test_pidfd_send_signal�sI��
�
�
�w�
'�
'�2��$�$�Q��
�
�6�(�
�<�<������-��M�M�:�;�
�\�\�
�
�5�;�;�
.��M�M�>�?�������+�+�U�[�[�9��7�7�V�B�I�I�K�=�1�2�>�>�B��������(�+�
�
#�
#�I�/G�
H�
H��$�$�X�v�}�}�f�h��J�I�
�
�
�0�
1�
1��$�$�X�v�}�}�=�2�
1�(�
'�
'��I�
H��
1�
1�
1�s5�&G4�/0H�&H�4H	�=H	�H	�H	�H,	�$H,	r!)r@r<rArBr�r�r�rr^rCrDrEs@rrSrS�s0����
�����+�,�$��
>�	�
>rrSc�2�[O2P!rJ)r�
reap_childrenr!rr�tearDownModulerb�s�����r�__main__)0r-r>rPr9r�rrr�r�r�r+r*r�r�r�r�test.supportrrrrr�test.support.script_helperrr	r�ImportError�TestCaserr�r,rHr�r�r�r�r�r!r�r6r`r�r�r7rSrbr@�mainr!rr�<module>ris�������	�
�
�
���
�������F���
/=�8�$�$�/=�d
�������(�*@�A�c=��"�"�c=�B�c=�T
���S�\�\�W�,�.@�A�-D��*�*�-D�B�-D�`N!�H�%�%�N!�b
�������(�*@�A�t=��)�)�t=�B�t=�n
���W�V�\�2�4L�M�@%�h�/�/�@%�N�@%�F
�������(�*@�A�	���W�V�^�4�6S�T�����	���W�R��(�*>�?�R&�x�(�(�R&�@��U�B�R&�j
�������(�*@�A�	���W�V�[�1�R�R�g�f�k�6R�J�L�\1��"�"�\1�L�B�\1�~P4�(�+�+�P4�f
}��"�"�}�@)O�h�'�'�)O�Z>�h�'�'�>�*��z���M�M�O���e-���I��s�J>�>K�K�
K

Youez - 2016 - github.com/yon3zu
LinuXploit