[gobject-introspection] giscanner: Encode data passed to subprocess.stdin.write



commit 0767a754f63423a4fb5d2cf279198dbc72e31543
Author: Simon Feltman <sfeltman src gnome org>
Date:   Mon Apr 28 20:39:55 2014 -0700

    giscanner: Encode data passed to subprocess.stdin.write
    
    ASCII encode bytes sent to subprocess.stdin.write to ensure
    Python 2 and 3 compatibility.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679438

 giscanner/sourcescanner.py |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py
index 88531a7..9a591e1 100644
--- a/giscanner/sourcescanner.py
+++ b/giscanner/sourcescanner.py
@@ -291,9 +291,8 @@ class SourceScanner(object):
         cc = CCompiler()
 
         tmp_fd_cpp, tmp_name_cpp = tempfile.mkstemp(prefix='g-ir-cpp-', suffix='.c')
-        fp_cpp = os.fdopen(tmp_fd_cpp, 'w')
-        self._write_preprocess_src(fp_cpp, defines, undefs, filenames)
-        fp_cpp.close()
+        with os.fdopen(tmp_fd_cpp, 'wb') as fp_cpp:
+            self._write_preprocess_src(fp_cpp, defines, undefs, filenames)
 
         tmpfile_basename = os.path.basename(os.path.splitext(tmp_name_cpp)[0])
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]