fix: remove unnecessary eval from error snapshot
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
This commit is contained in:
parent
ea0b10d1a7
commit
763e8cfcae
1 changed files with 2 additions and 11 deletions
|
|
@ -123,22 +123,13 @@ def get_snapshot(exception, context=10):
|
|||
# add exception type, value and attributes
|
||||
if isinstance(evalue, BaseException):
|
||||
for name in dir(evalue):
|
||||
# prevent py26 DeprecationWarning
|
||||
if (name != 'messages' or sys.version_info < (2.6)) and not name.startswith('__'):
|
||||
if name != 'messages' and not name.startswith('__'):
|
||||
value = pydoc.text.repr(getattr(evalue, name))
|
||||
|
||||
# render multilingual string properly
|
||||
if isinstance(value, six.text_type):
|
||||
value = eval(value)
|
||||
|
||||
s['exception'][name] = encode(value)
|
||||
|
||||
# add all local values (of last frame) to the snapshot
|
||||
for name, value in locals.items():
|
||||
if isinstance(value, six.text_type):
|
||||
value = eval(value)
|
||||
|
||||
s['locals'][name] = pydoc.text.repr(value)
|
||||
s['locals'][name] = value if isinstance(value, six.text_type) else pydoc.text.repr(value)
|
||||
|
||||
return s
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue