Handle possible issue on Python 2.x when writing to thread buffer

The problem happens when value has type "unicode" that shouldn't be decoded
This commit is contained in:
Valerii Koval
2020-05-20 17:04:50 +03:00
parent e31591a35e
commit 8840b28968

View File

@ -52,7 +52,7 @@ class MultiThreadingStdStream(object):
thread_id = thread_get_ident() thread_id = thread_get_ident()
self._ensure_thread_buffer(thread_id) self._ensure_thread_buffer(thread_id)
return self._buffers[thread_id].write( return self._buffers[thread_id].write(
value.decode() if is_bytes(value) else value value.decode() if not PY2 and is_bytes(value) else value
) )
def get_value_and_reset(self): def get_value_and_reset(self):