[j0%JX d dl Z d dlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddZ
d Zd
Ze j
dk rd ZdS er d dlZd
ZdS # e$ r d ZY dS w xY wd dlZ G d dej Zd ZdS ) N)CodeType )TemplateSyntaxError)PYPY)
internal_code)missingc t j \ }}}t |t r[|j sTd|_ | |_ | d n# t $ r Y nw xY wt |d|j pd|j
}n|j }g }||j j
t v r|j }|j j d }|G| |j }t |||j | }| | n| | |j }|d}t) | D ]}t+ || }|||fS )a 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 exc_info: A :meth:`sys.exc_info` tuple. If not provided,
the current ``exc_info`` is used.
:param source: For ``TemplateSyntaxError``, the original source if
known.
:return: A :meth:`sys.exc_info` tuple that can be re-raised.
TNz