관리-도구
편집 파일: traceback.cpython-311.opt-1.pyc
� c��fc� � �� � d Z ddlZddlZddlZddlZddlZddlmZ g d�Z d2d�Z d� Zd3d�Zd2d�Z d2d �Zd ZdZ G d� d � � Z e� � Zd� Zeedddfd�Zeeddfd�Zefd�Zd� Zefd�Zd4d�Zd5d�Zd4d�Zd6d�Zd3d�Zd3d�Zd� Z G d� d� � Z!d� Z"d� Z#d � Z$d!� Z%d"Z& G d#� d$e'� � Z(d%� Z) ej* d&g d'�d(d)g�*� � Z+d+� Z,d,Z-d-� Z. G d.� d/� � Z/ G d0� d1� � Z0dS )7z@Extract, format and print information about Python stack traces.� N)�suppress)� extract_stack� extract_tb�format_exception�format_exception_only�format_list�format_stack� format_tb� print_exc� format_exc�print_exception� print_last�print_stack�print_tb�clear_frames�FrameSummary�StackSummary�TracebackException� walk_stack�walk_tbc � � |�t j }t � | � � � � � D ]}t ||d�� � �dS )zyPrint the list of tuples as returned by extract_tb() or extract_stack() as a formatted stack trace to the given file.N� ��file�end)�sys�stderrr � from_list�format�print)�extracted_listr �items �0/opt/alt/python311/lib64/python3.11/traceback.py� print_listr$ s[ � � �|��z���&�&�~�6�6�=�=�?�?� '� '�� �d��2�&�&�&�&�&�'� '� c �Z � t � | � � � � � S )a� Format a list of tuples or FrameSummary objects for printing. Given a list of tuples or FrameSummary objects as returned by extract_tb() or extract_stack(), return a list of strings ready for printing. Each string in the resulting list corresponds to the item with the same index in the argument list. Each string ends in a newline; the strings may contain internal newlines as well, for those items whose source text line is not None. )r r r )r! s r# r r s$ � � �!�!�.�1�1�8�8�:�:�:r% c �F � t t | |�� � |�� � dS )a Print up to 'limit' stack trace entries from the traceback 'tb'. If 'limit' is omitted or None, all entries are printed. If 'file' is omitted or None, the output goes to sys.stderr; otherwise 'file' should be an open file or file-like object with a write() method. ��limit�r N)r$ r )�tbr) r s r# r r / s* � � �z�"�E�*�*�*��6�6�6�6�6�6r% c �H � t | |�� � � � � S )z5A shorthand for 'format_list(extract_tb(tb, limit))'.r( )r r �r+ r) s r# r r 9 s! � ��b��&�&�&�-�-�/�/�/r% c �T � t � t | � � |�� � S )a# Return a StackSummary object representing a list of pre-processed entries from traceback. This is useful for alternate formatting of stack traces. If 'limit' is omitted or None, all entries are extracted. A pre-processed stack trace entry is a FrameSummary object containing attributes filename, lineno, name, and line representing the information that is usually printed for a stack trace. The line is a string with leading and trailing whitespace stripped; if the source is not available it is None. r( )r � _extract_from_extended_frame_gen�_walk_tb_with_full_positionsr- s r# r r = s. � � �8�8�$�R�(�(�� 9� 7� 7� 7r% zG The above exception was the direct cause of the following exception: zF During handling of the above exception, another exception occurred: c � � e Zd Zd� ZdS )� _Sentinelc � � dS )Nz <implicit>� ��selfs r# �__repr__z_Sentinel.__repr__[ s � ��|r% N)�__name__� __module__�__qualname__r7 r4 r% r# r2 r2 Z s# � � � � � �� � � � r% r2 c � � |t u |t u k rt d� � �||cxu r t u rJn nG| �Ct | t � � r | | j fS t dt | � � j � d�� � �dS ||fS )Nz-Both or neither of value and tb must be givenzException expected for value, z found�NN)� _sentinel� ValueError� isinstance� BaseException� __traceback__� TypeError�typer8 )�exc�valuer+ s r# �_parse_value_tbrF ` s� � � ����i��0�0��H�I�I�I�������i�������?��#�}�-�-� .��C�-�-�-�� :�#�C�y�y�1�:� :� :� ;� ;� ;� �:��"�9�r% Tc � � t | ||� � \ }}t t |� � |||d�� � }|� ||�� � dS )a� Print exception up to 'limit' stack trace entries from 'tb' to 'file'. This differs from print_tb() in the following ways: (1) if traceback is not None, it prints a header "Traceback (most recent call last):"; (2) it prints the exception type and value after the stack trace; (3) if type is SyntaxError and value has the appropriate format, it prints the line where the syntax error occurred with a caret on the next line indicating the approximate position of the error. T�r) �compact�r �chainN)rF r rC r )rD rE r+ r) r rK �tes r# r r o sS � � ��U�B�/�/�I�E�2� �D��K�K���%�� N� N� N�B��H�H�$�e�H�$�$�$�$�$r% c � � t | ||� � \ }}t t |� � |||d�� � }t |� |�� � � � S )az Format a stack trace and the exception information. The arguments have the same meaning as the corresponding arguments to print_exception(). The return value is a list of strings, each ending in a newline and some containing internal newlines. When these lines are concatenated and printed, exactly the same text is printed as does print_exception(). TrH �rK )rF r rC �listr )rD rE r+ r) rK rL s r# r r � sS � � ��U�B�/�/�I�E�2� �D��K�K���%�� N� N� N�B��� � �� �&�&�'�'�'r% c � � |t u r| }t t |� � |dd�� � }t |� � � � � S )a� Format the exception part of a traceback. The return value is a list of strings, each ending in a newline. The list contains the exception's message, which is normally a single string; however, for :exc:`SyntaxError` exceptions, it contains several lines that (when printed) display detailed information about where the syntax error occurred. Following the message, the list contains the exception's ``__notes__``. NT)rI )r= r rC rO r )rD rE rL s r# r r � sJ � � � ����� �D��K�K���d� C� C� C�B���(�(�*�*�+�+�+r% c �J � t |d� � }|�|sd| z }n| �d|�d�}|S )N� exceptionz%s z: � )�_safe_string)�etyperE �valuestr�lines r# �_format_final_exc_linerX � s<