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

Jesús Cea Avión report at bugs.python.org
Tue Sep 13 13:57:46 CEST 2011


Jesús Cea Avión <jcea at jcea.es> 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 supported in Python 3...

In python 2.7 I get this: "TypeError: coercing to Unicode: need string or buffer, int found".

----------
nosy: +jcea

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12969>
_______________________________________


More information about the Python-bugs-list mailing list