New submission from Mo Ali:
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
----------
messages: 285644
nosy: Mo Ali
priority: normal
severity: normal
status: open
title: python3 open() does not check argument type before attempting to read()
or write()
type: crash
versions: Python 3.5
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue29297>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com