Kristján Valur Jónsson added the comment:

No, the socket is actually closed when response's close() method is called.  
The problem is that the HTTPResponse object, buried deep within the nested 
classes returned from do_open(), has a circular reference, and _it_ will not go 
away.

No one is _relying_ on garbage collection in the sense that this is not, I 
think, designed behaviour, merely an unintentional effect of storing a bound 
method in the object inance.

As always, circular reference should be avoided when possible since relying on 
gc is not something to be done lightly.

Now, I think that changing the complicated wrapping at this stage is not 
possible, but merely replacing the bound method with a weak method might just 
do the trick.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7464>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to