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

Ezio Melotti report at bugs.python.org
Tue Sep 13 14:56:23 CEST 2011


Ezio Melotti <ezio.melotti at gmail.com> 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 will most likely be passed to open as a string.

----------

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


More information about the Python-bugs-list mailing list