From 3f04a353d7bac512bee38f15e8a12269a868d356 Mon Sep 17 00:00:00 2001 From: Ethan Furman Date: Sat, 4 Jun 2016 14:38:43 -0700 Subject: issue27186: add open/io.open; patch by Jelle Zijlstra --- Lib/_pyio.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Lib/_pyio.py') diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 7b89347a4c..40df79d345 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): -- cgit v1.2.1 From 3a9cf1568b8063cd4c1c9168ee4aa7e15ffc131d Mon Sep 17 00:00:00 2001 From: Martin Panter Date: Sun, 12 Jun 2016 01:56:50 +0000 Subject: Drop unused import --- Lib/_pyio.py | 1 - 1 file changed, 1 deletion(-) (limited to 'Lib/_pyio.py') diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 40df79d345..d0947f06d5 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -6,7 +6,6 @@ import os import abc import codecs import errno -import array import stat import sys # Import _thread instead of threading to reduce startup cost -- cgit v1.2.1