On 8/3/07, Jeremy Hylton <[EMAIL PROTECTED]> wrote: > On 8/3/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > The docs are out of date, we don't dup() any more (that was needed > > only because we were using fdopen()). But what *should* happen is that > > when you close the file object the socket is still open. The socket > > wrapper's close() method should be fixed. I can look into that later > > today. > > Ok. I confirmed that calling dup() fixes the problem, but that > doesn't work on Windows. I also uncovered a bug in socket.py, which > fails to set _can_dup_socket to True on platforms where you can dup a > socket.
Followup: Jeremy fixed this by adding an explicit reference count to the socket object, counting how many makefile() streams are hanging off it. A few more unit tests (including httplib) are now working. However, things are still not all good. E.g. $ rm -f CP936.TXT $ ./python Lib/test/regrtest.py -uall test_codecmaps_cn test_codecmaps_cn fetching http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP936.TXT ... test test_codecmaps_cn crashed -- <class 'error'>: (9, 'Bad file descriptor') 1 test failed: test_codecmaps_cn [68157 refs] $ ./python ... >>> import urllib [46065 refs] >>> x = urllib.urlopen("http://python.org").read() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/google/home/guido/python/py3k-struni/Lib/io.py", line 390, in read return self.readall() File "/usr/local/google/home/guido/python/py3k-struni/Lib/io.py", line 400, in readall data = self.read(DEFAULT_BUFFER_SIZE) File "/usr/local/google/home/guido/python/py3k-struni/Lib/io.py", line 392, in read n = self.readinto(b) File "/usr/local/google/home/guido/python/py3k-struni/Lib/socket.py", line 264, in readinto return self._sock.recv_into(b) socket.error: (9, 'Bad file descriptor') [60365 refs] >>> -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com