classification
Title: ElementTree: file locking in Jython 2.5 (OSError on Windows)
Type: behavior Stage: committed/rejected
Components: Windows, XML Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: flox Nosy List: brian.curtin, flox, gdoutch, pjenvey, python-dev
Priority: normal Keywords: patch

Created on 2009-11-16 15:56 by gdoutch, last changed 2011-10-29 01:39 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
issue7334_etree_patch.diff flox, 2010-02-16 13:59 Patch, apply to trunk
Messages (7)
msg95349 - (view) Author: Gareth Doutch (gdoutch) Date: 2009-11-16 15:56
I have a problem with an xml file locking after read and/or write.

I have a short sample code with unit test available here:
http://bugs.jython.org/file741/lock.py

Below are the
outputs from Jython and CPython (v 2.5.4).
 
I am using Jython 2.5.1 on Windows XP and java version "1.6.0_16".

>jython lock.py
E
======================================================================
ERROR: runTest (__main__.TestDelete)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "W:\testTeam\SIT\JySit\sit\scripts\lock.py", line 73, in tearDown
    os.remove(self.fileName)
  File "C:\jython2.5.1\Lib\os.py", line 342, in remove
    raise OSError(0, "couldn't delete file", path)
OSError: [Errno 0] couldn't delete file: 'C:\\testdir\\test.xml'
 
----------------------------------------------------------------------
Ran 1 test in 0.454s
 
FAILED (errors=1)
 
 
>python lock.py
.
----------------------------------------------------------------------
Ran 1 test in 0.015s
 
OK


The problem can be cured by applying the changes as per file:
http://bugs.jython.org/file742/ElementTree.py
msg95350 - (view) Author: Gareth Doutch (gdoutch) Date: 2009-11-16 16:02
This is on the Jython list:
http://bugs.jython.org/issue1479
msg99409 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-02-16 13:59
The patch proposed on msg95349:
 * need tests
 * not reviewed (yet)
msg102762 - (view) Author: Philip Jenvey (pjenvey) * (Python committer) Date: 2010-04-10 02:48
Patch with tests (which can only really test it on Windows) here

http://bitbucket.org/pjenvey/et-2009-provolone/changeset/8292a06090a3/
msg124621 - (view) Author: Philip Jenvey (pjenvey) * (Python committer) Date: 2010-12-24 23:53
Florent, any chance of signing off on this for 3.2? I was waiting for the patch to go through your authorized elementtree fork
msg146587 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2011-10-29 01:09
Changeset cff78ffb932a fixed the issue for 3.2.
I will consider backporting.
msg146588 - (view) Author: Roundup Robot (python-dev) Date: 2011-10-29 01:39
New changeset eceaa31252b3 by Florent Xicluna in branch '2.7':
Closes #7334: close source files on ElementTree.parse and iterparse (partial backport of issue #10093 from 3.2).
http://hg.python.org/cpython/rev/eceaa31252b3
History
Date User Action Args
2011-10-29 01:39:41python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg146588

stage: patch review -> committed/rejected
2011-10-29 01:09:28floxsetresolution: fixed
stage: needs patch -> patch review
messages: + msg146587
versions: - Python 3.2
2010-12-24 23:53:27pjenveysetassignee: pjenvey -> flox
messages: + msg124621
nosy: pjenvey, brian.curtin, flox, gdoutch
2010-04-10 02:49:55brian.curtinsetnosy: + brian.curtin
2010-04-10 02:48:45pjenveysetmessages: + msg102762
2010-02-16 13:59:10floxsetfiles: + issue7334_etree_patch.diff
priority: normal

title: XML file locking in Jython 2.5 (OSError on Windows) -> ElementTree: file locking in Jython 2.5 (OSError on Windows)
keywords: + patch
nosy: + flox

messages: + msg99409
stage: needs patch
2009-11-17 04:15:33pjenveysetassignee: pjenvey

nosy: + pjenvey
versions: + Python 2.7, Python 3.2, - Python 2.5
2009-11-16 16:02:56gdoutchsetmessages: + msg95350
2009-11-16 15:56:07gdoutchcreate