Message5700

Author pekka.klarck
Recipients pekka.klarck
Date 2010-04-14.11:23:18
SpamBayes Score 3.028411e-11
Marked as misclassified No
Message-id <1271244199.08.0.392551485287.issue1598@psf.upfronthosting.co.za>
In-reply-to
Content
The reason for the bug is the ElementTree.parse doesn't close the source file it opens. This bug doesn't appear with CPython because there the source file is immediately garbage collected and thus automatically closed when the parse method is exited. On Unixes the example in the original description passes also with Jython, apparently because there the OS doesn't lock the opened file similarly as on Windows.

I tested that adding `source.close()` at the end of the parse method was enough to make the original example pass. That's probably not the right way to fix this, though, as the source should be closed only if it's opened inside parse. I don't have Jython development environment set up and cannot create patch now, but I can do that later if there is a need.

IMHO code in Python stdlib shouldn't rely on CPython gc behavior and the fix should thus be done there. Should I open a separate issue there?
History
Date User Action Args
2010-04-14 11:23:19pekka.klarcksetmessageid: <1271244199.08.0.392551485287.issue1598@psf.upfronthosting.co.za>
2010-04-14 11:23:19pekka.klarcksetrecipients: + pekka.klarck
2010-04-14 11:23:19pekka.klarcklinkissue1598 messages
2010-04-14 11:23:18pekka.klarckcreate