This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年09月16日 10:15 by lars.gustaebel, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg170550 - (view) | Author: Lars Gustäbel (lars.gustaebel) * (Python committer) | Date: 2012年09月16日 10:15 | |
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? |
|||
| msg170554 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年09月16日 13:35 | |
I don't think so. We don't try to protect people from all their mistakes, and a file descriptor of 1 is valid, and True == 1. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:36 | admin | set | github: 60154 |
| 2012年09月17日 20:19:55 | jcea | set | nosy:
+ jcea |
| 2012年09月16日 13:35:23 | r.david.murray | set | status: open -> closed nosy: + r.david.murray messages: + msg170554 resolution: wont fix stage: resolved |
| 2012年09月16日 10:15:15 | lars.gustaebel | create | |