mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
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!
This commit is contained in:
parent
e0fdf6f1a8
commit
b3f9f4b729
1 changed files with 5 additions and 2 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue