From 01ffd024041ac933854c367fb8d1b5682d19883f Mon Sep 17 00:00:00 2001
From: shadchin <shadchin@yandex-team.com>
Date: Tue, 3 Oct 2023 23:32:21 +0300
Subject: Update Python 3 to 3.11.6

---
 contrib/tools/python3/src/Python/fileutils.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'contrib/tools/python3/src/Python/fileutils.c')

diff --git a/contrib/tools/python3/src/Python/fileutils.c b/contrib/tools/python3/src/Python/fileutils.c
index e1af39ddf0..79ce20bd72 100644
--- a/contrib/tools/python3/src/Python/fileutils.c
+++ b/contrib/tools/python3/src/Python/fileutils.c
@@ -1687,6 +1687,7 @@ _Py_fopen_obj(PyObject *path, const char *mode)
         Py_END_ALLOW_THREADS
     } while (f == NULL
              && errno == EINTR && !(async_err = PyErr_CheckSignals()));
+    int saved_errno = errno;
 #if !USE_UNICODE_WCHAR_CACHE
     PyMem_Free(wpath);
 #endif /* USE_UNICODE_WCHAR_CACHE */
@@ -1711,13 +1712,14 @@ _Py_fopen_obj(PyObject *path, const char *mode)
         Py_END_ALLOW_THREADS
     } while (f == NULL
              && errno == EINTR && !(async_err = PyErr_CheckSignals()));
-
+    int saved_errno = errno;
     Py_DECREF(bytes);
 #endif
     if (async_err)
         return NULL;
 
     if (f == NULL) {
+        errno = saved_errno;
         PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError, path);
         return NULL;
     }
-- 
cgit v1.2.3