| Server IP : 118.27.122.248 / Your IP : 216.73.216.15 Web Server : Apache System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64 User : c9415830 ( 11735) PHP Version : 8.4.17 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/alt/python36/lib64/python3.6/test/__pycache__/ |
Upload File : |
3
�w2_Xn � @ s$ d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl m
Z
d dlmZm
Z
mZ d dlZd dlZd dlmZ yd dlZdZW n ek
r� dZY nX yd dlZW n ek
r� dZY nX dZejd kZddd�Zed
d� �Zdd� ZG dd� dej�Zedk�r ej � dS )� )�contextmanagerN)�support)�
script_helper�
is_android�requires_android_level)�dedentTFg �?�nt� c C sL |}|d| 7 }|d| 7 }d|k r<d|d |d | S d| d S d S )Nz# File "<string>", line %s in func
z& File "<string>", line %s in <module>r �^�
�$� )Zlineno1Zlineno2�header� min_count�regexr
r
�;/opt/alt/python36/lib64/python3.6/test/test_faulthandler.py�expected_traceback s r c c s$ t j� } z
| V W d tj| � X d S )N)�tempfileZmktempr �unlink)�filenamer
r
r �temporary_filename% s
r c C s t s| S tdd�| �S )N� zraise() is buggy)r r )�testr
r
r �requires_raise- s r c @ s@ e Zd Zd�dd�Zdddddd�dd�Zdd � Zd
d� Zeje j
jd�d
�dd� �Ze
dd� �Zeje d�dd� �Zdd� Zeje j
dkd�dd� �Zejedkd�ejeed�d�e
dd� ���Zejedkd�ejeed �d!�e
d"d#� ���Zd$d%� Zd&d'� Zeje j
jd(��oed)�ejeed*� d+�d,d-� ��Ze
d.d/� �Ze
d0d1� �Zeje j
dkd2�e
d3d4� ��Ze
d5d6� �Z e
d7d8� �Z!d9d:� Z"d;d<� Z#d=d>� Z$d?d@� Z%dddA�dBdC�Z&dDdE� Z'dFdG� Z(eje j
dkd2�dHdI� �Z)dJdK� Z*eje d�dLdM� �Z+dNdO� Z,dPdQ� Z-ejeedR� dS�d�dddA�dVdW��Z.dXdY� Z/dZd[� Z0d\d]� Z1d^d_� Z2eje j
dkd2�d`da� �Z3dbdc� Z4ejeedd� de�d�dfdg��Z5dhdi� Z6djdk� Z7dldm� Z8eje j
dkd2�dndo� �Z9dpdq� Z:drds� Z;e<dtdu� �Z=dvdw� Z>eje?dx�dydz� �Z@eje?dx�d{d|� �ZAeje?dx�d}d~� �ZBeje?dx�dd�� �ZCdS )��FaultHandlerTestsNc C s t |�j� }g }|dk r"|j|� tj� �: tjd||d�}|� |j� \}}|j� }W dQ R X W dQ R X tj |�} | j
dd�} |r�| j| d� t|d��}
|
j
� } W dQ R X | j
dd�} nT|dk �r| j| d� tj|tjd� t|dd d
��}
|
j
� } W dQ R X | j
dd�} | j� |fS )a{
Run the specified code in Python (in a new child process) and read the
output from the standard error or from a file (if filename is set).
Return the output lines as a list.
Strip the reference count from the standard error for Python debug
build, and replace "Current thread 0x00007f8d8fbd9700" by "Current
thread XXX".
Nz-c)�pass_fds�ascii�backslashreplace� �rbr F)�closefd)r �strip�appendr ZSuppressCrashReportr Zspawn_pythonZcommunicate�waitZstrip_python_stderr�decode�assertEqual�open�read�os�lseek�SEEK_SET�
splitlines)�self�coder �fdr Zprocess�stdout�stderr�exitcode�output�fpr
r
r �
get_output2 s.
zFaultHandlerTests.get_outputT)r �all_threads�other_regexr. �know_current_threadc
C s~ |r|rd} qd} nd} d}
t |
j||| d��j� }
|rD|
d| 7 }
| j|||d�\}}dj|�}| j||
� | j|d � d
S )z�
Check that the fault handler for fatal errors is enabled and check the
traceback from the child process output.
Raise an error if the output doesn't match the expected format.
zCurrent thread 0x[0-9a-f]+zThread 0x[0-9a-f]+ZStackz�
^{fatal_error}
{header} \(most recent call first\):
File "<string>", line {lineno} in <module>
)�lineno�fatal_errorr �|)r r. r r N)r �formatr! r4 �join�assertRegex�assertNotEqual)
r, r- �line_numberr9 r r5 r6 r. r7 r r r2 r1 r
r
r �check_errorT s
zFaultHandlerTests.check_errorc K s d| }| j |||f|� d S )NzFatal Python error: %s)r@ )r, r- r? �
name_regex�kwr9 r
r
r �check_fatal_erroru s z#FaultHandlerTests.check_fatal_errorc K s d| }| j |||f|� d S )NzWindows fatal exception: %s)r@ )r, r- r? rA rB r9 r
r
r �check_windows_exceptiony s z)FaultHandlerTests.check_windows_exception�aixz5the first page of memory is a mapped read-only on AIXc C s&