I\'m working on a Python library used by third-party developers to write extensions for our core application.
I\'d like to know if it\'s possible to modify the trace
Take a look at what jinja2 does here:
https://github.com/mitsuhiko/jinja2/blob/5b498453b5898257b2287f14ef6c363799f1405a/jinja2/debug.py
It's ugly, but it seems to do what you need done. I won't copy-paste the example here because it's long.