[issue43292] xml.ElementTree iterparse filehandle left open

2022-03-07 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Library (Lib)
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
superseder: Add the close method for ElementTree.iterparse() object -> 
versions: +Python 3.10, Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43292] xml.ElementTree iterparse filehandle left open

2022-03-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 852d9b77abefcad2bb8d203e3ab9f2ca49ab305f by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-43292: Fix file leak in `ET.iterparse()` when not exhausted 
(GH-31696) (GH-31720)
https://github.com/python/cpython/commit/852d9b77abefcad2bb8d203e3ab9f2ca49ab305f


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43292] xml.ElementTree iterparse filehandle left open

2022-03-07 Thread miss-islington


miss-islington  added the comment:


New changeset 8acbb93c0763fa53b5959fe05d86ba275c9e8a5b by Miss Islington (bot) 
in branch '3.10':
bpo-43292: Fix file leak in `ET.iterparse()` when not exhausted (GH-31696)
https://github.com/python/cpython/commit/8acbb93c0763fa53b5959fe05d86ba275c9e8a5b


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43292] xml.ElementTree iterparse filehandle left open

2022-03-07 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +29835
pull_request: https://github.com/python/cpython/pull/31720

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43292] xml.ElementTree iterparse filehandle left open

2022-03-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29836
pull_request: https://github.com/python/cpython/pull/31721

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43292] xml.ElementTree iterparse filehandle left open

2022-03-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 496c428de3318c9c5770937491b71dc3d3f18a6a by Jacob Walls in branch 
'main':
bpo-43292: Fix file leak in `ET.iterparse()` when not exhausted (GH-31696)
https://github.com/python/cpython/commit/496c428de3318c9c5770937491b71dc3d3f18a6a


--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43292] xml.ElementTree iterparse filehandle left open

2022-03-05 Thread Jacob Walls


Change by Jacob Walls :


--
keywords: +patch
nosy: +jacobtylerwalls
nosy_count: 4.0 -> 5.0
pull_requests: +29815
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/31696

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43292] xml.ElementTree iterparse filehandle left open

2021-03-10 Thread Martin Panter


Change by Martin Panter :


--
type: security -> resource usage

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43292] xml.ElementTree iterparse filehandle left open

2021-03-10 Thread Martin Panter


Martin Panter  added the comment:

Perhaps this can be handled with Issue 25707, which is open for adding an API 
to close the file, similar to how "os.scandir" iterator implements a context 
manager and "close" method.

--
nosy: +martin.panter
superseder:  -> Add the close method for ElementTree.iterparse() object

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43292] xml.ElementTree iterparse filehandle left open

2021-02-23 Thread Tom Dougherty


Tom Dougherty  added the comment:

"erase all files"

--
nosy: +dtom9424
type: crash -> security

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43292] xml.ElementTree iterparse filehandle left open

2021-02-21 Thread Viktor Kis


Viktor Kis  added the comment:

Confirmed that no apps were using the created xml file or folder. Windows 
Explorer was closed for all folders only the terminal shell was open. Issue 
still persists on windows 10 OS.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43292] xml.ElementTree iterparse filehandle left open

2021-02-21 Thread anthony shaw


anthony shaw  added the comment:

Example script attached works perfectly on macOS 

> python3.9 test.py
[('default', 
'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties'), 
('vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes')]
[('default', 
'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties'), 
('vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes')]

--
nosy: +anthonypjshaw

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43292] xml.ElementTree iterparse filehandle left open

2021-02-21 Thread Viktor Kis


Viktor Kis  added the comment:

ran python 3.9.2 on windows 10

1) What did you do?
Tried to remove folder that contains a xml file that was worked on by 
ElementTree iterparse with argument source='filename' (string type input)
2. What happened?
python was not able to remove the folder due to file lock still held by 
iterparse.
3. What did you expect to happen
iterparse was supposed to close the filehandle such that the user could then 
write/move/delete the xml file worked on, however python gave a PermissionError:

Traceback (most recent call last):
  File 
"C:\Users\vkisf\Desktop\00_MYSTUFF\01_SOFTWARE\01_PYTHON\01_GITHUB\pycascades2021\ETiterparse.py",
 line 43, in 
shutil.rmtree('subdir2')
  File 
"C:\Users\vkisf\Desktop\00_MYSTUFF\01_SOFTWARE\01_PYTHON\01_GITHUB\pycascades2021\cpython\lib\shutil.py",
 line 740, in rmtree
return _rmtree_unsafe(path, onerror)
  File 
"C:\Users\vkisf\Desktop\00_MYSTUFF\01_SOFTWARE\01_PYTHON\01_GITHUB\pycascades2021\cpython\lib\shutil.py",
 line 618, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
  File 
"C:\Users\vkisf\Desktop\00_MYSTUFF\01_SOFTWARE\01_PYTHON\01_GITHUB\pycascades2021\cpython\lib\shutil.py",
 line 616, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is 
being used by another process: 'subdir2\\app.xml'

--
nosy:  -anthonypjshaw

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43292] xml.ElementTree iterparse filehandle left open

2021-02-21 Thread anthony shaw


anthony shaw  added the comment:

which version of Python were you doing this on?

The function in question is 
https://github.com/python/cpython/blob/master/Lib/xml/etree/ElementTree.py#L1233-L1278

--
nosy: +anthonypjshaw

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43292] xml.ElementTree iterparse filehandle left open

2021-02-21 Thread Viktor Kis


New submission from Viktor Kis :

Standard library xml.ElementTree - iterparse does not close filehandle properly 
when breaking out of a for loop iterating with iterparse. The issue only occurs 
when the user passes a "string" as a source object instead of a filehandle 
(that is because a user's filehandle can safely be closed in a context manager 
as shown in the attachment).

--
components: XML
files: ETiterparse.py
messages: 387494
nosy: vkisforever
priority: normal
severity: normal
status: open
title: xml.ElementTree iterparse filehandle left open
type: crash
versions: Python 3.9
Added file: https://bugs.python.org/file49826/ETiterparse.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com