This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author moi90
Recipients cvrebert, iritkatriel, moi90, ncoghlan, rbcollins
Date 2021-10-29.06:27:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In this pull request[1] I introduced a `format_locals` which can be provided to customize the serialization of the local variables of each frame. This could be used to filter out variables with certain names, for example. In this context, you could use a certain naming convention for variables with sensitive information and filter them out:

def _format_locals(filename, lineno, name, locals):
    return {k: repr(v) for k,v in locals.items() if not k.endsswith("_sensitive")}

traceback.TracebackException.from_exception(e, capture_locals=True, format_locals=format_locals).format()

(This should be exactly what Robert was suggesting.)

Date User Action Args
2021-10-29 06:27:23moi90setrecipients: + moi90, ncoghlan, rbcollins, cvrebert, iritkatriel
2021-10-29 06:27:23moi90setmessageid: <>
2021-10-29 06:27:23moi90linkissue23597 messages
2021-10-29 06:27:23moi90create