[Python-3000] socket makefile bug

Jeremy Hylton jeremy at alum.mit.edu
Fri Aug 3 18:34:06 CEST 2007


On 8/3/07, Guido van Rossum <guido at python.org> 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.

Jeremy

>
> On 8/3/07, Jeremy Hylton <jeremy at alum.mit.edu> wrote:
> > I'm looking into httplib problems on the struni branch.  One
> > unexpected problem is that socket.makefile() is not behaving
> > correctly. The docs say "The file object references a dup()ped version
> > of the socket file descriptor, so the file object and socket object
> > may be closed or garbage-collected independently."  In Python 3000,
> > the object returned by makefile is no a dup()ped versoin of the file
> > descriptor.  If I close the socket, I close the file returned by
> > makefile().
> >
> > I can dig into the makefile() problem, but I thought I'd mention in
> > the hopes that someone else thinks its easy to fix.
> >
> > Jeremy
> > _______________________________________________
> > Python-3000 mailing list
> > Python-3000 at python.org
> > http://mail.python.org/mailman/listinfo/python-3000
> > Unsubscribe: http://mail.python.org/mailman/options/python-3000/guido%40python.org
> >
>
>
> --
> --Guido van Rossum (home page: http://www.python.org/~guido/)
>


More information about the Python-3000 mailing list