summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-06-12 15:05:15 (GMT)
committerGuido van Rossum <guido@python.org>1998-06-12 15:05:15 (GMT)
commitb3f9f4b729ae70dc97c8855feafafc2d66c9f9fd (patch)
tree2ca1088d544bc000a04cf77417b09b45dc4e2005
parente0fdf6f1a8066272de01ce02500ea53738b28f90 (diff)
downloadcpython-b3f9f4b729ae70dc97c8855feafafc2d66c9f9fd.zip
cpython-b3f9f4b729ae70dc97c8855feafafc2d66c9f9fd.tar.gz
cpython-b3f9f4b729ae70dc97c8855feafafc2d66c9f9fd.tar.bz2
On Windows, make the pipe() call return Unix file descriptors instead
of Windows file handles. Now it is at least compatible with itself on Unix!
-rw-r--r--Modules/posixmodule.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index b35d471..cafb46f 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -2237,15 +2237,18 @@ posix_pipe(self, args)
return Py_BuildValue("(ii)", fds[0], fds[1]);
#else /* MS_WIN32 */
HANDLE read, write;
+ int read_fd, write_fd;
BOOL ok;
if (!PyArg_Parse(args, ""))
return NULL;
Py_BEGIN_ALLOW_THREADS
- ok = CreatePipe( &read, &write, NULL, 0);
+ ok = CreatePipe(&read, &write, NULL, 0);
Py_END_ALLOW_THREADS
if (!ok)
return posix_error();
- return Py_BuildValue("(ii)", read, write);
+ read_fd = _open_osfhandle((long)read, 0);
+ write_fd = _open_osfhandle((long)write, 1);
+ return Py_BuildValue("(ii)", read_fd, write_fd);
#endif /* MS_WIN32 */
#endif
}