[IronPython] socket, _socket, and socket.py

Dino Viehland dinov at microsoft.com
Wed May 18 00:48:13 CEST 2011


I think manual ref count tracking (like _make_filerefs) + defining __del__ on the socket objects would fix it.  But there may be issues w/ that - when we first encountered this I pinged python-dev and I recall Guido saying that there were problems getting anything else working on Windows.  So there may be some oddity that prevents this from working but I don't know what that is off the top of my head.

> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-
> bounces at lists.ironpython.com] On Behalf Of Zachary Gramana
> Sent: Tuesday, May 17, 2011 3:38 PM
> To: Discussion of IronPython
> Subject: Re: [IronPython] socket, _socket, and socket.py
> 
> I noticed this, with a little disappointment. I also noticed that they
> implemented a sort of ersatz/platform agnostic reference tracking system in
> ssl.py.  Seeing the _makefile_refs system got me thinking about the whole
> ssl.py/_ssl.pyd paradigm and sockets.cs, since I remembered you tackled this
> issue once before (or one very similar to it:
> http://lists.ironpython.com/pipermail/users-ironpython.com/2007-
> May/004946.html).
> 
> Perhaps something along the lines of _makefile_refs and
> GC.SuppressFinalize might get us closer?
> 
> On 5/17/2011 6:06 PM, Dino Viehland wrote:
> > There is actually more of a story to this though - Cpython's socket.py
> > relies upon reference counting for handling dup.  See this comment
> > from
> > socket.py:
> >
> > # Wrapper around platform socket objects. This implements
> >
> > # a platform-independent dup() functionality. The
> >
> > # implementation currently relies on reference counting
> >
> > # to close the underlying socket object.
> >
> > class _socketobject(object):
> >
> > Because IronPython doesn't have a reference counting GC we cannot
> > simply use socket.py.  So someone would need to patch both IronPython
> > and socket.py so this would work.  For the record it looks like Jython
> > also has a custom socket.py.
> >
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list