[issue25688] File leak in ElementTree.iterparse()

2015-11-23 Thread Martin Panter
Martin Panter added the comment: Patch 2 looks good. I like the new version of the tests better. -- ___ Python tracker ___

[issue25688] File leak in ElementTree.iterparse()

2015-11-23 Thread Roundup Robot
Roundup Robot added the comment: New changeset 6e23777948f3 by Serhiy Storchaka in branch '3.4': Issue #25688: Fixed file leak in ElementTree.iterparse() raising an error. https://hg.python.org/cpython/rev/6e23777948f3 New changeset 267d04459ba3 by Serhiy Storchaka in branch '3.5': Issue

[issue25688] File leak in ElementTree.iterparse()

2015-11-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for your review Martin. Opened issue25707 for adding the close method. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue25688] File leak in ElementTree.iterparse()

2015-11-22 Thread Martin Panter
Martin Panter added the comment: What’s the point of the catch_warnings() and filterwarnings() calls in the tests? They don’t seem to be doing much; I think the CleanContext manager is already enabling warnings. Perhaps you could call simplefilter("error", ResourceWarning) instead. Also I’m

[issue25688] File leak in ElementTree.iterparse()

2015-11-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Warning is emitted in destructor, and exceptions in destructors are ignored. Hence turning it into error makes the test passed. Tests were not correct, here is fixed patch. Yes, CleanContext does the work. But depending on it looks fragile. CleanContext

[issue25688] File leak in ElementTree.iterparse()

2015-11-21 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: ElementTree.iterparse() can leak internally open file in case of error. Proposed patch fixes the leak. -- components: Library (Lib) files: etree_iterparse_leak.patch keywords: patch messages: 255051 nosy: eli.bendersky, scoder, serhiy.storchaka