summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHu Jialun <hujialun@outlook.sg>2022-01-21 18:39:39 +0000
committerEmmanuele Bassi <ebassi@gmail.com>2022-02-02 18:48:13 +0000
commitcbe75d5445b26f4ac877d1324e4d50933091cbd9 (patch)
tree720fb41b37ed4d23b6bdce281b0c55883706ead3
parent3b2d2e67461d16c48a4066b2c8a9f6b7b3c869bd (diff)
downloadgobject-introspection-cbe75d5445b26f4ac877d1324e4d50933091cbd9.tar.gz
Use binary mode buffer for stdout
By default, stdout is in text mode, expecting a str rather than byte. Change the output destination to the underlying binary buffer to write bytes.
-rw-r--r--giscanner/scannermain.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
index 957ba0b7..1124bc74 100644
--- a/giscanner/scannermain.py
+++ b/giscanner/scannermain.py
@@ -471,7 +471,7 @@ def create_source_scanner(options, args):
def write_output(data, options):
"""Write encoded XML 'data' to the filename specified in 'options'."""
if options.output == "-":
- output = sys.stdout
+ output = sys.stdout.buffer
try:
output.write(data)
except IOError as e: