提交 36184075 authored 作者: Jayanth Koushik's avatar Jayanth Koushik 提交者: GitHub

Open tempfile in mode 'w' to prevent TypeError

For printing compilation errors, a NamedTemporaryFile object is opened in the default mode ('w+b'), and strings are written to it. This is not an issue in Python 2, but in Python 3, strings cannot be implicitly converted to bytes so a TypeError occurs on line 2310 (previously 2309). This commit explicitly opens the NamedTemporaryFile in mode 'w'.
上级 b3d19ce8
...@@ -2302,6 +2302,7 @@ class GCC_compiler(Compiler): ...@@ -2302,6 +2302,7 @@ class GCC_compiler(Compiler):
if status: if status:
tf = tempfile.NamedTemporaryFile( tf = tempfile.NamedTemporaryFile(
mode='w',
prefix='theano_compilation_error_', prefix='theano_compilation_error_',
delete=False delete=False
) )
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论