summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen Demeyer <jdemeyer@cage.ugent.be>2018-04-16 10:07:22 +0200
committerJeroen Demeyer <jdemeyer@cage.ugent.be>2018-04-16 10:07:22 +0200
commit53d49801abc76d6da884ac329cac98b64e9bcb9d (patch)
treeedc73d56c3dad98ec677990e82055309252082d4
parentUpdated SageMath version to 8.2.rc2 (diff)
In cython(), redirect file descriptor 2 instead of sys.stderru/jdemeyer/cython___does_not_work_in_jupyter
-rw-r--r--src/sage/misc/cython.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/sage/misc/cython.py b/src/sage/misc/cython.py
index 2ac668a..0d4660f 100644
--- a/src/sage/misc/cython.py
+++ b/src/sage/misc/cython.py
@@ -661,7 +661,12 @@ def cython(filename, verbose=0, compile_message=False,
# Capture errors from distutils and its child processes
with open(os.path.join(target_dir, name + ".err"), 'w+') as errfile:
try:
- with redirection(sys.stderr, errfile, close=False):
+ # Redirect stderr to errfile. We use the file descriptor
+ # number "2" instead of "sys.stderr" because we really
+ # want to redirect the messages from GCC. These are sent
+ # to the actual stderr, regardless of what sys.stderr is.
+ sys.stderr.flush()
+ with redirection(2, errfile, close=False):
dist.run_command("build")
finally:
errfile.seek(0)