This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gregory.p.smith
Recipients amaury.forgeotdarc, ggenellina, gregory.p.smith, gvanrossum, jhylton, romkyns, zanella
Date 2008-09-26.05:57:42
SpamBayes Score 4.18221e-13
Marked as misclassified No
Message-id <1222408665.97.0.977158411533.issue3826@psf.upfronthosting.co.za>
In-reply-to
Content
The whole socket._io_refs thing looks like a real design flaw.  What is
its actual intended purpose?

When close is called on the socket object itself, the socket MSUT be
closed.  Why is our API otherwise?

Its up to the programming to ensure that no other references to that
socket wrapped in whatever layers will be used after that, if they are
they'll eventually get errors when an IO occurs.


I think this behavior started with this change:

------------------------------------------------------------------------
r56714 | jeremy.hylton | 2007-08-03 13:40:09 -0700 (Fri, 03 Aug 2007) |
21 lines

Make sure socket.close() doesn't interfere with socket.makefile().

If a makefile()-generated object is open and its parent socket is
closed, the parent socket should remain open until the child is
closed, too.  The code to support this is moderately complex and
requires one extra slots in the socket object.

This change fixes httplib so that several urllib2net test cases pass
again.

Add SocketCloser class to socket.py, which encapsulates the
refcounting logic for sockets after makefile() has been called.

Move SocketIO class from io module to socket module.  It's only use is
to implement the raw I/O methods on top of a socket to support
makefile().

Add unittests to test_socket to cover various patterns of close and
makefile.

...............
later modified by this (still the same effect):
...............

------------------------------------------------------------------------
r58970 | guido.van.rossum | 2007-11-14 14:32:02 -0800 (Wed, 14 Nov 2007)
| 6 lines

Patch 1439 by Bill Janssen.  I think this will work.
Tested on Windows by Christian Heimes.
I changed the code slightly, renaming decref_socketios() to
_decref_socketios(), and moving it closer to the close() method
that it calls.  Hopefully Bill can now submit his SSL port to 3.0.
History
Date User Action Args
2008-09-26 05:57:46gregory.p.smithsetrecipients: + gregory.p.smith, gvanrossum, jhylton, amaury.forgeotdarc, ggenellina, zanella, romkyns
2008-09-26 05:57:45gregory.p.smithsetmessageid: <1222408665.97.0.977158411533.issue3826@psf.upfronthosting.co.za>
2008-09-26 05:57:45gregory.p.smithlinkissue3826 messages
2008-09-26 05:57:42gregory.p.smithcreate