Re: [xml] Support for Python
- From: Gary Benson <gary inauspicious org>
- To: Dave Kuhlman <dkuhlman cutter rexx com>
- Cc: xml gnome org
- Subject: Re: [xml] Support for Python
- Date: Mon, 28 Jan 2002 22:40:54 +0000 (GMT)
On Mon, 28 Jan 2002, Dave Kuhlman wrote:
_But_, I worry about code like the following:
doc = p.xmlParseFile('test1.xml')
root = doc.children
doc = p.xmlParseFile('test1.xml')
Now, root contains a reference to a Python object that contains a
reference to an underlying C object (a libxml node) that has gone
away. Am I right about this? If so it seems very dangerous.
xmlFreeDoc frees the nodes in the doc, too, doesn't it?
Hmmm, if xmlNodes in doc.children have references to the parent (ie the
xmlDoc) then this _should_ work -- the first doc won't be garbage
collected because root.parent is referencing it. On the other hand, it
might have created an undeletable object.
Ick! I expect the best way to resolve what happens here would be a bit of
good old printf() debugging :)
Cheers,
Gary
[ gary inauspicious org ][ GnuPG 85A8F78B ][ http://inauspicious.org/ ]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]