summaryrefslogtreecommitdiffstats
path: root/Lib/traceback.py
diff options
context:
space:
mode:
authorSimon-Martin Schröder <martin.schroeder@nerdluecht.de>2022-07-11 09:14:15 (GMT)
committerGitHub <noreply@github.com>2022-07-11 09:14:15 (GMT)
commit46fc584b00f2ccee5b77d8fc525881def8670a02 (patch)
treed8b899911c740c27a46423686b444870cbfc1e90 /Lib/traceback.py
parentda717519ecd17bf6c7ed334c12ff861f63b0f14f (diff)
downloadcpython-46fc584b00f2ccee5b77d8fc525881def8670a02.zip
cpython-46fc584b00f2ccee5b77d8fc525881def8670a02.tar.gz
cpython-46fc584b00f2ccee5b77d8fc525881def8670a02.tar.bz2
gh-87822: Make traceback module robust to exceptions from repr() of local values (GH-94691)
Diffstat (limited to 'Lib/traceback.py')
-rw-r--r--Lib/traceback.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py
index 55f8080..b1a5fd0 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -279,7 +279,8 @@ class FrameSummary:
self._line = line
if lookup_line:
self.line
- self.locals = {k: repr(v) for k, v in locals.items()} if locals else None
+ self.locals = {k: _safe_string(v, 'local', func=repr)
+ for k, v in locals.items()} if locals else None
self.end_lineno = end_lineno
self.colno = colno
self.end_colno = end_colno