Commit b3f9f4b7 authored by Guido van Rossum's avatar Guido van Rossum

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!
parent e0fdf6f1
...@@ -2237,15 +2237,18 @@ posix_pipe(self, args) ...@@ -2237,15 +2237,18 @@ posix_pipe(self, args)
return Py_BuildValue("(ii)", fds[0], fds[1]); return Py_BuildValue("(ii)", fds[0], fds[1]);
#else /* MS_WIN32 */ #else /* MS_WIN32 */
HANDLE read, write; HANDLE read, write;
int read_fd, write_fd;
BOOL ok; BOOL ok;
if (!PyArg_Parse(args, "")) if (!PyArg_Parse(args, ""))
return NULL; return NULL;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
ok = CreatePipe( &read, &write, NULL, 0); ok = CreatePipe(&read, &write, NULL, 0);
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (!ok) if (!ok)
return posix_error(); 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 /* MS_WIN32 */
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment