관리-도구
편집 파일: debug.cpython-37.pyc
B F��a.! � @ s� d dl Z d dlZd dlZd dlmZ d dlmZ ddlmZ ddl m Z ddl mZ ejrfddl mZ deje ed �d d�Zeeje eeed�d d�Zejeejf ejeejf d�dd�Zejdkr�eeje ed�dd�Zn�e �� dk�rJyd dlZW n. ek �r. eeje ed�dd�ZY nX eeje ed�dd�Zn2d dlZG dd� dej�Z eeje ed�dd�ZdS )� N)�CodeType)� TracebackType� )�TemplateSyntaxError)� internal_code)�missing)�Context)�source�returnc C s t �� \}}}t�t|�}t�t|�}t|t�rd|jsdd|_| |_ |� d� t|d|jpZd|j �}n|j}g }xn|dk r�|jjtkr�|j}qp|jj�d�}|dk r�|�|j�}t|||j|�}|�|� n |�|� |j}qpW d}xt|�D ]}t||�}q�W |� |�S )ax Rewrite the current exception to replace any tracebacks from within compiled template code with tracebacks that look like they came from the template source. This must be called within an ``except`` block. :param source: For ``TemplateSyntaxError``, the original source if known. :return: The original exception with the rewritten traceback. TNz <unknown>Z__jinja_template__)�sys�exc_info�t�cast� BaseExceptionr � isinstancer Z translatedr �with_traceback�fake_traceback�filename�lineno�tb_next�tb_frame�f_coder � f_globals�getZget_corresponding_lineno� tb_lineno�append�reversed�tb_set_next) r �_� exc_value�tb�stack�templater Zfake_tbr � r# �=/opt/alt/python37/lib/python3.7/site-packages/jinja2/debug.py�rewrite_traceback_stack s4 r% )r r r r r c C s |dk r"t |jj�}|�dd� ni }||| d�}td|d d |d�}d}|dk r�|jjj}|d krnd }n|�d�r�d|d d� ��}tj dkr�|j |d�}n@t|j|j |j|j|j|j|j|j|j|j||j|j|j|j�}yt|||� W n tk �r t�� d jS X dS )a, Produce a new traceback object that looks like it came from the template source instead of the compiled code. The filename, line number, and location name will point to the template, and the local variables will be the current template context. :param exc_value: The original exception to be re-raised to create the new traceback. :param tb: The original traceback to get the local variables and code info from. :param filename: The template filename. :param lineno: The line number in the template source. N�__jinja_exception__)�__name__�__file__r&