summaryrefslogtreecommitdiffstats
path: root/Include/cpython
diff options
context:
space:
mode:
authorSegev Finer <segev208@gmail.com>2021-04-23 22:00:27 (GMT)
committerGitHub <noreply@github.com>2021-04-23 22:00:27 (GMT)
commit5e437fb872279960992c9a07f1a4c051b4948c53 (patch)
treeda3e3ad584eba24da9cfe63c4acd1a01e55d4676 /Include/cpython
parent6b59e662fa39a356d6eb03d349b140477857f4b1 (diff)
downloadcpython-5e437fb872279960992c9a07f1a4c051b4948c53.zip
cpython-5e437fb872279960992c9a07f1a4c051b4948c53.tar.gz
cpython-5e437fb872279960992c9a07f1a4c051b4948c53.tar.bz2
bpo-30555: Fix WindowsConsoleIO fails in the presence of fd redirection (GH-1927)
This works by not caching the handle and instead getting the handle from the file descriptor each time, so that if the actual handle changes by fd redirection closing/opening the console handle beneath our feet, we will keep working correctly.
Diffstat (limited to 'Include/cpython')
-rw-r--r--Include/cpython/fileutils.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/Include/cpython/fileutils.h b/Include/cpython/fileutils.h
index 954f078..ccf37e9 100644
--- a/Include/cpython/fileutils.h
+++ b/Include/cpython/fileutils.h
@@ -161,4 +161,12 @@ PyAPI_FUNC(int) _Py_dup(int fd);
PyAPI_FUNC(int) _Py_get_blocking(int fd);
PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking);
-#endif /* !MS_WINDOWS */
+#else /* MS_WINDOWS */
+PyAPI_FUNC(void*) _Py_get_osfhandle_noraise(int fd);
+
+PyAPI_FUNC(void*) _Py_get_osfhandle(int fd);
+
+PyAPI_FUNC(int) _Py_open_osfhandle_noraise(void *handle, int flags);
+
+PyAPI_FUNC(int) _Py_open_osfhandle(void *handle, int flags);
+#endif /* MS_WINDOWS */