diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2016-06-04 21:38:43 (GMT) |
---|---|---|
committer | Ethan Furman <ethan@stoneleaf.us> | 2016-06-04 21:38:43 (GMT) |
commit | d62548afede899e71e59a2a0b31f19fdf031c560 (patch) | |
tree | 11dc76fe4b5c89d93c63e8bdf4b9ec535fde6451 /Lib/_pyio.py | |
parent | 228c636908bda8a6b20b0f6930655fbaedc4ebad (diff) | |
download | cpython-d62548afede899e71e59a2a0b31f19fdf031c560.zip cpython-d62548afede899e71e59a2a0b31f19fdf031c560.tar.gz cpython-d62548afede899e71e59a2a0b31f19fdf031c560.tar.bz2 |
issue27186: add open/io.open; patch by Jelle Zijlstra
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r-- | Lib/_pyio.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 7b89347..40df79d 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -161,6 +161,8 @@ def open(file, mode="r", buffering=-1, encoding=None, errors=None, opened in a text mode, and for bytes a BytesIO can be used like a file opened in a binary mode. """ + if not isinstance(file, int): + file = os.fspath(file) if not isinstance(file, (str, bytes, int)): raise TypeError("invalid file: %r" % file) if not isinstance(mode, str): |