issue27186: add open/io.open; patch by Jelle Zijlstra
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 @@
     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):