[issue12969] Command 'open(0, "wb").close()' cause crash of Python interpreter [interactive mode]

2011-09-13 Thread Ezio Melotti
Ezio Melotti added the comment: fd support is intentional, see Modules/_io/_iomodule.c:318 OTOH closing sys.stdin doesn't exit Python, so I'm not sure why closing fd 0 should. I was also thinking about possible security implications of this, but if someone tries to pass '0' as filename, it w

[issue12969] Command 'open(0, "wb").close()' cause crash of Python interpreter [interactive mode]

2011-09-13 Thread Jesús Cea Avión
Jesús Cea Avión added the comment: In "help(open)" I see this: """ file is either a text or byte string giving the name (and the path if the file isn't in the current working directory) of the file to be opened or an integer file descriptor of the file to be wrapped. (If a file

[issue12969] Command 'open(0, "wb").close()' cause crash of Python interpreter [interactive mode]

2011-09-13 Thread Jesús Cea Avión
Jesús Cea Avión added the comment: Under Python 3, open(integer) tries to open a file descriptor. So, "f=open(0,...); f.close()" closes stdin, rightly shutting down the interpreter. It is not a crash, it is a shutdown. Tested under Linux. The point is if opening a file descriptor is actually

[issue12969] Command 'open(0, "wb").close()' cause crash of Python interpreter [interactive mode]

2011-09-13 Thread Ezio Melotti
Changes by Ezio Melotti : -- components: +IO nosy: +benjamin.peterson, ezio.melotti, pitrou, stutzbach stage: -> test needed versions: +Python 3.3 ___ Python tracker ___ ___

[issue12969] Command 'open(0, "wb").close()' cause crash of Python interpreter [interactive mode]

2011-09-12 Thread Jiří Kučera
New submission from Jiří Kučera : Invoking the `close' method of `_io.BufferedWriter' instance created by `open(0,"wb")' command cause the Python interpreter crash. Python interpreter info: mode: interactive version info: Python 3.2.1 (default, Jul 10 2011, 21:51:15) [MSC v.1500 32 bit (In