mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-140601: Add ResourceWarning to iterparse when not closed (GH-140603)
When iterparse() opens a file by filename and is not explicitly closed, emit a ResourceWarning to alert developers of the resource leak. Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
209eaff68c
commit
a486d452c7
5 changed files with 69 additions and 4 deletions
|
|
@ -656,6 +656,10 @@ Functions
|
|||
.. versionchanged:: 3.13
|
||||
Added the :meth:`!close` method.
|
||||
|
||||
.. versionchanged:: next
|
||||
A :exc:`ResourceWarning` is now emitted if the iterator opened a file
|
||||
and is not explicitly closed.
|
||||
|
||||
|
||||
.. function:: parse(source, parser=None)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue