[issue6242] Fix reference leak in io.StringIO

2009-10-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: I just noticed that this hadn't been committed to trunk. I did the backport myself, but in the future please first commit IO changes to trunk and then merge to py3k. -- ___ Python tracker

[issue6242] Fix reference leak in io.StringIO

2009-07-21 Thread Alexandre Vassalotti
Alexandre Vassalotti added the comment: Patch committed in r74155 (branches/py3k). -- resolution: -> accepted stage: patch review -> committed/rejected status: open -> closed ___ Python tracker ___

[issue6242] Fix reference leak in io.StringIO

2009-06-09 Thread Alexandre Vassalotti
Alexandre Vassalotti added the comment: > Why do you need all this? Isn't it enough to take a weakref and check > the callback is triggered? No, because you would need a weak reference to the instance's __dict__, which is unavailable for io.StringIO. Anyway, here's a simplified patch without t

[issue6242] Fix reference leak in io.StringIO

2009-06-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: Why do you need all this? Isn't it enough to take a weakref and check the callback is triggered? (besides, we should avoid tests which only work in debug mode) -- ___ Python tracker

[issue6242] Fix reference leak in io.StringIO

2009-06-08 Thread Alexandre Vassalotti
Alexandre Vassalotti added the comment: Here's an updated patch. The new patch also cleans up tp_clear, tp_traverse and tp_dealloc of io.BytesIO which used weakreflist incorrectly. I also added support for test_memoryio for adding reference leak regression tests. As you'll see, the support is a

[issue6242] Fix reference leak in io.StringIO

2009-06-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: It seems wrong to call PyObject_ClearWeakRefs() in stringio_clear(). Weakrefs should only be notified when the object is deallocated, not cleared. Besides, you should add a test for this, so that the leak can be spotted with regrtest -R. -- nosy: +pitro

[issue6242] Fix reference leak in io.StringIO

2009-06-08 Thread Alexandre Vassalotti
New submission from Alexandre Vassalotti : io.StringIO does not clear its reference to its attributes dictionary when deleted. This causes a leak when io.StringIO has attributes. >>> def leak(): ...for _ in range(100): ... f = io.StringIO() ... f.foo = 1 ... [39348 refs] >>> leak