관리-도구
편집 파일: debug.cpython-39.pyc
a P}<b� � @ s� d dl Z d dlZd dlmZ d dlmZ ddlmZ ddlm Z ddlm Z ejr^ddlm Z deje ed �d d�Zeeje eeed�d d�Zejeejf ejeejf d�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 }|dur�|jjtv r�|j}qn|jj�d�}|dur�|�|j�}t|||j|�}|�|� n |�|� |j}qnd}t|�D ]}||_|}q�|� |�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) r �_� exc_value�tb�stack�templater Zfake_tbr � r"