New submission from Martin <martin.schroe...@nerdluecht.de>:

With `capture_locals=True`, `StackSummary.format` prints the local variables 
for every frame:
https://github.com/python/cpython/blob/4827483f47906fecee6b5d9097df2a69a293a85c/Lib/traceback.py#L440

This will fail, however, if string conversion fails.

StackSummary.format should be robust towards such possibilities.


An easy fix would be a utility function:

```
def try_str(x):
  try:
    return str(x)
  except:
    return "<some sensible hint>"
```

----------
messages: 389679
nosy: moi90
priority: normal
severity: normal
status: open
title: StackSummary.format fails if str(value) fails
type: enhancement
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43656>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to