[pypy-issue] [issue1098] sys.stdout.close() from interactive session crashes pypy and messes up terminal

hm tracker at bugs.pypy.org
Sun Mar 25 01:51:22 CET 2012


New submission from hm <hacman0 at gmail.com>:

Those last few $s are the result of hitting return a few times after pypy has quit.  The terminal does not seem to want to print newlines anymore.  
This happened on a Mac using the standard terminal program, but I have observed the same behavior in using iterm and on linux as well (the crash and 
the lack of newlines, although this is from an ssh session initiated on the same mac--I can check from a proper linux box at some point as well).

$ pypy
Python 2.7.2 (2346207d99463f299f09f3e151c9d5fa9158f71b, Feb 20 2012, 04:52:48)
[PyPy 1.8.0] on darwin
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``ECOOP is happening''
>>>> import sys
>>>> sys.stdout.close()
Traceback (most recent call last):
                                    File "app_main.py", line 51, in run_toplevel
                                                                                  File "/opt/local/lib/pypy/lib_pypy/_pypy_interact.py", line 40, in 
interactive_console
                       run_multiline_interactive_console(mainmodule)
                                                                      File "/opt/local/lib/pypy/lib_pypy/pyrepl/simple_interact.py", line 58, in 
run_multiline_interactive_console
                                 returns_unicode=True)
                                                        File "/opt/local/lib/pypy/lib_pypy/pyrepl/readline.py", line 210, in multiline_input
                                                                                                                                                return 
reader.readline(returns_unicode=returns_unicode)
                                                    File "/opt/local/lib/pypy/lib_pypy/pyrepl/reader.py", line 594, in readline
                                                                                                                                   self.restore()
                                                                                                                                                   File 
"/opt/local/lib/pypy/lib_pypy/pyrepl/reader.py", line 494, in restore
                                                                            self.console.restore()
                                                                                                    File 
"/opt/local/lib/pypy/lib_pypy/pyrepl/unix_console.py", line 396, in restore
                                   self.flushoutput()
                                                       File "/opt/local/lib/pypy/lib_pypy/pyrepl/unix_console.py", line 497, in flushoutput
                                                                                                                                               
self.__tputs(text)
              File "/opt/local/lib/pypy/lib_pypy/pyrepl/unix_console.py", line 515, in __tputs
                                                                                                  os.write(self.output_fd, fmt)
                                                                                                                               OSError: [Errno 9] Bad 
file descriptor
                $ $ $ $

----------
messages: 4136
nosy: hacman, pypy-issue
priority: bug
status: unread
title: sys.stdout.close() from interactive session crashes pypy and messes up terminal

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1098>
________________________________________


More information about the pypy-issue mailing list