python: Check "buffer" when writing to sys.stdout for python2 compat.
* lang/python/tests/support.py (print_data): Add check for buffer. -- When running with something like make -C lang/python check verbose=2 the test would fail under python2, because the file objects do not have a buffer property. Signed-off-by: Tobias Mueller <muelli@cryptobitch.de>
This commit is contained in:
parent
154389f2a5
commit
ae21d2705f
@ -48,7 +48,11 @@ def print_data(data):
|
|||||||
except:
|
except:
|
||||||
# Hope for the best.
|
# Hope for the best.
|
||||||
pass
|
pass
|
||||||
sys.stdout.buffer.write(data)
|
|
||||||
|
if hasattr(sys.stdout, "buffer"):
|
||||||
|
sys.stdout.buffer.write(data)
|
||||||
|
else:
|
||||||
|
sys.stdout.write(data)
|
||||||
|
|
||||||
def mark_key_trusted(ctx, key):
|
def mark_key_trusted(ctx, key):
|
||||||
class Editor(object):
|
class Editor(object):
|
||||||
|
Loading…
Reference in New Issue
Block a user