fix: remove unnecessary eval from error snapshot

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
This commit is contained in:
Chinmay D. Pai 2020-05-07 17:29:35 +05:30
parent ea0b10d1a7
commit 763e8cfcae
No known key found for this signature in database
GPG key ID: 75507BE256F40CED

View file

@ -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