diff options
author | Gabriel <g2p.code@gmail.com> | 2012-11-23 23:48:47 +0100 |
---|---|---|
committer | Gabriel <g2p.code@gmail.com> | 2012-11-23 23:58:19 +0100 |
commit | 649c90831075b5141b56e321f21c576ee58a06a6 (patch) | |
tree | aaf5a499072b4811b91b2a5be5ebd60c2b9ebfcc /numpy/distutils/exec_command.py | |
parent | 20224ea62ed42a3ebc0795f62b78309ff9ab1a8a (diff) | |
download | numpy-649c90831075b5141b56e321f21c576ee58a06a6.tar.gz |
Assume we can use sys.stdout.fileno() and friends.
The workaround shouldn't be necessary in a recent python shell.
Tested in python, ipython.
In fact, distutils is almost never imported and run manually from an
interactive shell.
This removes the use of `sys.__stdout__`, which broke with distribute
0.6.30 on Python 3.
Diffstat (limited to 'numpy/distutils/exec_command.py')
-rw-r--r-- | numpy/distutils/exec_command.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/numpy/distutils/exec_command.py b/numpy/distutils/exec_command.py index e0c3e1c97..8f9076103 100644 --- a/numpy/distutils/exec_command.py +++ b/numpy/distutils/exec_command.py @@ -194,7 +194,7 @@ def exec_command( command, # _exec_command_posix uses os.system and is faster # but not on all platforms os.system will return # a correct status. - if _with_python and (0 or sys.__stdout__.fileno()==-1): + if _with_python and (0 or sys.stdout.fileno()==-1): st = _exec_command_python(command, exec_command_dir = exec_dir, **env) @@ -348,12 +348,10 @@ def _exec_command( command, use_shell=None, use_tee = None, **env ): argv = [os.environ['COMSPEC'],'/C'] + argv using_command = 1 - # sys.__std*__ is used instead of sys.std* because environments - # like IDLE, PyCrust, etc overwrite sys.std* commands. - so_fileno = sys.__stdout__.fileno() - se_fileno = sys.__stderr__.fileno() - so_flush = sys.__stdout__.flush - se_flush = sys.__stderr__.flush + so_fileno = sys.stdout.fileno() + se_fileno = sys.stderr.fileno() + so_flush = sys.stdout.flush + se_flush = sys.stderr.flush so_dup = os.dup(so_fileno) se_dup = os.dup(se_fileno) |