Serhiy Storchaka added the comment:

Builtin open() in Python 3 (and io.open() in Python 2.7) accept unicode 
strings, byte strings and integers as the first arguments (general path-like 
objects also are supported in Python 3.6, but it doesn't matter). bool is a 
subtype of int, and False is equal to integer 0. 0 is a file descriptor of 
sys.stdin.

>>> import sys
>>> sys.stdin.fileno()
0

Thus open(False) is equivalent to open(sys.stdin.fileno()). It creates a file 
object that wraps the file descriptor 0. This is legitimate operation.

----------
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29297>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to