]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
On Windows, make the pipe() call return Unix file descriptors instead
authorGuido van Rossum <guido@python.org>
Fri, 12 Jun 1998 15:05:15 +0000 (15:05 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 12 Jun 1998 15:05:15 +0000 (15:05 +0000)
of Windows file handles.  Now it is at least compatible with itself on
Unix!

Modules/posixmodule.c

index b35d471cbc94a50057f584da44ef7c8a4e95e940..cafb46fee6151bd4548820a3b50f9b9fd947e969 100644 (file)
@@ -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
 }