Issue #18571: Implementation of the PEP 446: file descriptors and file handles
are now created non-inheritable; add functions os.get/set_inheritable(),
os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
diff --git a/Python/import.c b/Python/import.c
index b18ba2c..1a162ee 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1797,7 +1797,7 @@
                           &name, PyUnicode_FSDecoder, &pathname, &fob))
         return NULL;
     if (fob != NULL) {
-        fp = _Py_fopen(pathname, "r");
+        fp = _Py_fopen_obj(pathname, "r");
         if (fp == NULL) {
             Py_DECREF(pathname);
             if (!PyErr_Occurred())