Message405287
| 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 |
<1635488843.48.0.08043499532.issue23597@roundup.psfhosted.org> |
| In-reply-to |
| Content |
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.)
[1] https://github.com/python/cpython/pull/29299 |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2021年10月29日 06:27:23 | moi90 | set | recipients:
+ moi90, ncoghlan, rbcollins, cvrebert, iritkatriel |
| 2021年10月29日 06:27:23 | moi90 | set | messageid: <1635488843.48.0.08043499532.issue23597@roundup.psfhosted.org> |
| 2021年10月29日 06:27:23 | moi90 | link | issue23597 messages |
| 2021年10月29日 06:27:23 | moi90 | create |
|