[issue23222] open doesn't provide traceback for int argument

SilentGhost report at bugs.python.org
Sun Jan 11 13:35:09 CET 2015


SilentGhost added the comment:

As explained in the docs[1] integer is a valid argument for the open function in the python3. It is also noted that the file descriptor is going to be closed, unless closefd argument to the open function was False, when f.close() is called. This is the behaviour you're seeing. Zero or other small integers tend to point to vital files opened by interpreter or the interpreter itself, so closing them shuts the interpreter down. This is a layman explanation, so someone should be able to provide a more technical description.

In either case this is not a bug and passing random arguments to the open function is probably not what should be done in any production code. I'm closing this issue.

[1] https://docs.python.org/3/library/functions.html#open

----------
components: +Interpreter Core -IO
nosy: +SilentGhost
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type:  -> behavior

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


More information about the Python-bugs-list mailing list