Skip to content

bpo-30555: Fix WindowsConsoleIO errors in the presence of fd redirection #1927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b02408d
bpo-30555: Fix WindowsConsoleIO failure in the presence of fd redirec…
segevfiner Jun 3, 2017
ac242eb
bpo-30555: Fixed the kludgey PC/_testconsole.c, grumble grumble...
segevfiner Jun 3, 2017
645dfa3
bpo-30555: Fix refleaks
segevfiner Jun 4, 2017
013d8ea
bpo-30555: Add _Py_{get,open}_osfhandle{,_noraise} and use them instead
segevfiner Jun 4, 2017
aaf6020
bpo-30555: Swapped the rest of the uses of _{get,open}_osfhandle
segevfiner Jun 4, 2017
7727bc5
bpo-30555: Swap intptr_t to void* in _Py_{get,open}_osfhandle{,_noraise}
segevfiner Jun 5, 2017
0644634
bpo-30555: msvcrtmodule.c: Use an argument clinic convertor instead o…
segevfiner Jun 5, 2017
82a18bb
Merge remote-tracking branch 'upstream/master' into bpo-30555-windows…
segevfiner Jun 8, 2017
ad77cd3
Merge remote-tracking branch 'upstream/master' into bpo-30555-windows…
segevfiner Jun 10, 2017
9dd4ea9
bpo-30555: Also consider NULL as a possible error in HANDLE_return_co…
segevfiner Jun 30, 2017
07a979f
Merge remote-tracking branch 'upstream/master' into bpo-30555-windows…
segevfiner Jul 6, 2017
69b13f7
Merge remote-tracking branch 'upstream/master' into bpo-30555-windows…
segevfiner Jul 27, 2017
e54f9c0
Merge remote-tracking branch 'upstream/master' into bpo-30555-windows…
segevfiner Dec 16, 2017
2d252ab
Add NEWS.d entry for bpo-30555
segevfiner Dec 16, 2017
d1cce96
Merge remote-tracking branch 'upstream/master' into bpo-30555-windows…
segevfiner Mar 9, 2018
64262c2
Merge remote-tracking branch 'origin/master' into bpo-30555-windowsco…
segevfiner Apr 14, 2019
36fccb4
Review fix
segevfiner Apr 14, 2019
40f678f
Merge remote-tracking branch 'upstream/master' into bpo-30555-windows…
segevfiner Apr 14, 2019
116fe9c
Merge remote-tracking branch 'upstream/master' into bpo-30555-windows…
segevfiner Nov 16, 2019
7990e20
Merge remote-tracking branch 'upstream/master' into bpo-30555-windows…
segevfiner Mar 16, 2021
bd8233e
fileno should error when closed
segevfiner Mar 16, 2021
b76da3e
Fix faulty call to IOBase.close introduced by automatic merge
segevfiner Mar 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Include/cpython/fileutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,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 */
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix ``WindowsConsoleIO`` errors in the presence of fd redirection. Patch by
Segev Finer.
13 changes: 5 additions & 8 deletions Modules/_io/clinic/winconsoleio.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ PyDoc_STRVAR(_io__WindowsConsoleIO_close__doc__,
"close($self, /)\n"
"--\n"
"\n"
"Close the handle.\n"
"Close the console object.\n"
"\n"
"A closed handle cannot be used for further I/O operations. close() may be\n"
"called more than once without error.");
"A closed console object cannot be used for further I/O operations.\n"
"close() may be called more than once without error.");

#define _IO__WINDOWSCONSOLEIO_CLOSE_METHODDEF \
{"close", (PyCFunction)_io__WindowsConsoleIO_close, METH_NOARGS, _io__WindowsConsoleIO_close__doc__},
Expand Down Expand Up @@ -110,10 +110,7 @@ PyDoc_STRVAR(_io__WindowsConsoleIO_fileno__doc__,
"fileno($self, /)\n"
"--\n"
"\n"
"Return the underlying file descriptor (an integer).\n"
"\n"
"fileno is only set when a file descriptor is used to open\n"
"one of the standard streams.");
"Return the underlying file descriptor (an integer).");

#define _IO__WINDOWSCONSOLEIO_FILENO_METHODDEF \
{"fileno", (PyCFunction)_io__WindowsConsoleIO_fileno, METH_NOARGS, _io__WindowsConsoleIO_fileno__doc__},
Expand Down Expand Up @@ -381,4 +378,4 @@ _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
#define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
#endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */
/*[clinic end generated code: output=a28b3120fa53b256 input=a9049054013a1b77]*/
/*[clinic end generated code: output=48080572ffee22f5 input=a9049054013a1b77]*/
Loading