]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport jackjansen's checkin of
authorMichael W. Hudson <mwh@python.net>
Mon, 25 Mar 2002 17:40:43 +0000 (17:40 +0000)
committerMichael W. Hudson <mwh@python.net>
Mon, 25 Mar 2002 17:40:43 +0000 (17:40 +0000)
    revision 1.211 of socketmodule.c

Due to interaction between the MSL C library and the GUSI I/O library I can get reads from sockets to work consistently either for unbuffered binary files or for buffered binary files, but not for both:-(

The workaround is to force socket.makefile() to disable buffering for binary files.

Fixes bug 534625. 2.2.1 candidate.

Modules/socketmodule.c

index 25912a4e6bdbf6e6e46566efa29d8c351a91415c..182496c2b173e4840ffa8436e5d4773941ec2438 100644 (file)
@@ -1453,6 +1453,11 @@ PySocketSock_makefile(PySocketSockObject *s, PyObject *args)
                        SOCKETCLOSE(fd);
                return PySocket_Err();
        }
+#ifdef USE_GUSI2
+       /* Workaround for bug in Metrowerks MSL vs. GUSI I/O library */
+       if (strchr(mode, 'b') != NULL )
+               bufsize = 0;
+#endif
        f = PyFile_FromFile(fp, "<socket>", mode, fclose);
        if (f != NULL)
                PyFile_SetBufSize(f, bufsize);