File: //home/arjun/projects/env/lib/python3.10/site-packages/jinja2/__pycache__/debug.cpython-310.pyc
o
%we� �
@ s� d dl Z d dlZd dlmZ d dlmZ ddlmZ ddlm Z ddlm
Z
ejr/ddlm
Z
dd eje d
efdd�Zd
edeje deded
ef
dd�Zdejeejf d
ejeejf fdd�ZdS )� N)�CodeType)�
TracebackType� )�TemplateSyntaxError)�
internal_code)�missing)�Context�source�returnc C s t �� \}}}t�t|�}t�t|�}t|t�r2|js2d|_| |_ |�
d� t|d|jp-d|j
�}n|j}g }|durp|jjtv rE|j}q7|jj�d�}|durd|�|j�}t|||j|�}|�|� n|�|� |j}|dus;d}t|�D ]}||_|}qv|�
|�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>�__jinja_template__)�sys�exc_info�t�cast�
BaseExceptionr �
isinstancer �
translatedr �with_traceback�fake_traceback�filename�lineno�tb_next�tb_frame�f_coder � f_globals�get�get_corresponding_lineno� tb_lineno�append�reversed) r �_� exc_value�tb�stack�templater �fake_tbr � r&