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.

Author Mo Ali
Recipients Mo Ali
Date 2017-01-17.14:43:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1484664216.19.0.300485907535.issue29297@psf.upfronthosting.co.za>
In-reply-to
Content
Python3 open(), read(), or write()doesn't check argument type before action causing a hang.  Would like to catch exceptions but not without an exception to return.  See below.

Python3.6:
Python 3.6.0 (default, Dec 24 2016, 08:01:42)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> test = False
>>> with open(str(test)) as f:
...     fail = f.read()
...


python2.7:
╰─λ python2                                                                                                                                                                                     0 < 09:35:31
Python 2.7.13 (default, Dec 18 2016, 07:03:39)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> test = False
>>> with open(test) as f:
...     fail = f.read()
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: coercing to Unicode: need string or buffer, bool found
History
Date User Action Args
2017-01-17 14:43:36Mo Alisetrecipients: + Mo Ali
2017-01-17 14:43:36Mo Alisetmessageid: <1484664216.19.0.300485907535.issue29297@psf.upfronthosting.co.za>
2017-01-17 14:43:36Mo Alilinkissue29297 messages
2017-01-17 14:43:35Mo Alicreate