提交 4ad9b755 编写于 作者: Z zhongpu 提交者: hong

fix paddle compile errors under some python versions (#21616)

* fix compile error in some python version, test=develop

* remove redudant code, test=develop
上级 be6a6396
...@@ -370,11 +370,13 @@ class InstallHeaders(Command): ...@@ -370,11 +370,13 @@ class InstallHeaders(Command):
if sys.platform != 'win32': if sys.platform != 'win32':
@contextmanager @contextmanager
def redirect_stdout(): def redirect_stdout():
with open('${SETUP_LOG_FILE}', 'w') as f: f_log = open('${SETUP_LOG_FILE}', 'w')
origin_stdout = sys.stdout origin_stdout = sys.stdout
sys.stdout = f sys.stdout = f_log
yield yield
sys.stdout = origin_stdout f_log = sys.stdout
sys.stdout = origin_stdout
f_log.close()
else: else:
@contextmanager @contextmanager
def redirect_stdout(): def redirect_stdout():
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册