fix: py3 compatibility for error snapshot creation (develop) (#9336)

* fix: py3 compatibility for error snapshot creation

* fix: remove invalid checks

* Revert "fix: remove invalid checks"

This reverts commit f636c122146e38a5e0cd964686a6c7187ccb53b4.

* fix: use six to maintain py2 and py3 compatibility
This commit is contained in:
Rohan 2020-01-27 21:32:23 +05:30 committed by Chinmay Pai
parent f11b8fc476
commit b427c934b0

View file

@ -128,14 +128,14 @@ def get_snapshot(exception, context=10):
value = pydoc.text.repr(getattr(evalue, name))
# render multilingual string properly
if type(value)==str and value.startswith(b"u'"):
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 type(value)==str and value.startswith(b"u'"):
if isinstance(value, six.text_type):
value = eval(value)
s['locals'][name] = pydoc.text.repr(value)