New submission from Lars Gustäbel:

Today I accidentally did this:

open(True).read()

Passing True as a file argument to open() does not fail, because a bool value 
is treated like an integer file descriptor (stdout in this case). Even worse is 
that the read() call hangs in an endless loop on my linux box. On windows I get 
an EBADF at least.

Wouldn't it be better if open() checked explicitly for a bool argument and 
raises a TypeError?

----------
components: IO
messages: 170550
nosy: lars.gustaebel
priority: normal
severity: normal
status: open
title: open() should not accept bool argument
type: behavior
versions: Python 3.2, Python 3.3

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

Reply via email to