summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Feltman <sfeltman@src.gnome.org>2014-04-28 20:39:55 -0700
committerColin Walters <walters@verbum.org>2015-09-29 23:16:32 -0400
commit0767a754f63423a4fb5d2cf279198dbc72e31543 (patch)
tree228672fa54db45b4fe623b074a7b1d59fa88760f
parentecbf1460ffe0f1f6fa42fe79b27c22969d194cf5 (diff)
downloadgobject-introspection-0767a754f63423a4fb5d2cf279198dbc72e31543.tar.gz
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
-rw-r--r--giscanner/sourcescanner.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py
index 88531a7b..9a591e1c 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])