[New-bugs-announce] [issue15950] open() should not accept bool argument

Lars Gustäbel report at bugs.python.org
Sun Sep 16 12:15:16 CEST 2012

New submission from Lars Gustäbel:

Today I accidentally did this:


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 <report at bugs.python.org>

More information about the New-bugs-announce mailing list