[issue8832] automate minidom.unlink() with a context manager

Kristján Valur Jónsson report at bugs.python.org
Thu May 27 15:03:02 CEST 2010


New submission from Kristján Valur Jónsson <kristjan at ccpgames.com>:

It is all to easy to forget to "unlink()" minidom documents resulting in huge memory usage.
This patch allows to automate that process with a context manager, similar to how files can be closed in the same way:

with xml.dom.minidom.parse() as dom:
    workwith(dom)

will automatically call dom.unlink() when context manager is exited.
Patch provided.

----------
components: Library (Lib)
files: minidomcontext.patch
keywords: easy, needs review, patch, patch
messages: 106610
nosy: krisvale
priority: normal
severity: normal
status: open
title: automate minidom.unlink() with a context manager
type: feature request
versions: Python 3.2
Added file: http://bugs.python.org/file17472/minidomcontext.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8832>
_______________________________________


More information about the Python-bugs-list mailing list