[IronPython] urllib.urlretrieve with IronPython 2a8

Curt Hagenlocher curt at hagenlocher.org
Fri Mar 21 22:36:43 CET 2008


I noticed that this still isn't fixed in 2.0b1, so I took another look at
socket.cs and realized that my analysis was slightly off.  There's already a
mechanism to track duplicated sockets in the form of the handleToSocket
mapping.  However, this mechanism isn't taken into account when deciding
whether or not to Close() the BCL Socket object.

Bottom line: I believe this bug can be fixed simply by moving the call to
_socket.Close() from socket.close into socket.RemoveHandleSocketMapping, and
only calling it when sockets.Count reaches zero.
On Mon, Feb 18, 2008 at 9:19 PM, Dino Viehland <dinov at exchange.microsoft.com>
wrote:

> This is a great analysis - based upon this I think it'll be pretty easy to
> fix this.  I'll take a look at it tomorrow and respond back.
>
> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:
> users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher
> Sent: Monday, February 18, 2008 4:19 PM
> To: Discussion of IronPython
>  Subject: Re: [IronPython] urllib.urlretrieve with IronPython 2a8
>
> On Feb 18, 2008 4:12 PM, Curt Hagenlocher <curt at hagenlocher.org> wrote:
> >
> > Is it possible that CPython's socket.close method won't actually close
> > the socket while there's still a makefile'd file attacked to the
> > underlying OS socket?  And that IronPython's will?  Because that's the
> > only explanation I can come up with.
>
> It is and it will.  CPython basically dups the socket handle when you
> call makefile, while IronPython does not.  That's the cause of this
> bug.
>
> By the way, the docstring for the IronPython socket class claims that
> makefile isn't implemented.  This is apparently only half-true. :P
>
> --
> Curt Hagenlocher
> curt at hagenlocher.org
>  _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080321/b292ffd6/attachment.html>


More information about the Ironpython-users mailing list