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 peci
Recipients a.badger, akuchling, amaury.forgeotdarc, bwelling, holdenweb, jafo, jhylton, manekcz, nswinton, orsenthil, peci, stephbul
Date 2009-09-04.10:17:13
SpamBayes Score 6.350584e-07
Marked as misclassified No
Message-id <1252059447.66.0.222476600136.issue1208304@psf.upfronthosting.co.za>
In-reply-to
Content
i also ran into the problem of cyclic dependencies. i know if i would
call gc.collect() the problem would be solved, but calling gc.collect()
takes a long time. 

the problem is the cyclic dependency with
r.recv=r.read

i have fixed it localy by wrapping the addinfourl into a new class (i
called it addinfourlFixCyclRef) and overloading the close method, and
within the close method set the recv to none again.

class addinfourlFixCyclRef(addinfourl):
    def close(self):
        if self.fp is not None and hasattr(self.fp, "_sock"):
            self.fp._sock.recv = None
        addinfourl.close(self)

....

        r.recv = r.read
        fp = socket._fileobject(r, close=True)

        resp = addinfourlFixCyclRef(fp, r.msg, req.get_full_url())


and when i call .close() from the response it just works. Unluckily i
had to patch even more in case there is an exception called.
For the whole fix see the attachment
History
Date User Action Args
2009-09-04 10:17:27pecisetrecipients: + peci, jhylton, akuchling, holdenweb, jafo, amaury.forgeotdarc, orsenthil, bwelling, stephbul, manekcz, nswinton, a.badger
2009-09-04 10:17:27pecisetmessageid: <1252059447.66.0.222476600136.issue1208304@psf.upfronthosting.co.za>
2009-09-04 10:17:26pecilinkissue1208304 messages
2009-09-04 10:17:26pecicreate