[Lxml-checkins] r44710 - lxml/trunk/src/lxml
scoder at codespeak.net
scoder at codespeak.net
Tue Jul 3 23:15:05 CEST 2007
Author: scoder
Date: Tue Jul 3 23:15:04 2007
New Revision: 44710
Modified:
lxml/trunk/src/lxml/etree.pyx
lxml/trunk/src/lxml/proxy.pxi
Log:
fix for None deallocation bug
Modified: lxml/trunk/src/lxml/etree.pyx
==============================================================================
--- lxml/trunk/src/lxml/etree.pyx (original)
+++ lxml/trunk/src/lxml/etree.pyx Tue Jul 3 23:15:04 2007
@@ -429,6 +429,7 @@
By pointing to a Document instance, a reference is kept to
_Document as long as there is some pointer to a node in it.
"""
+ cdef python.PyObject* _gc_doc
cdef _Document _doc
cdef xmlNode* _c_node
cdef object _tag
Modified: lxml/trunk/src/lxml/proxy.pxi
==============================================================================
--- lxml/trunk/src/lxml/proxy.pxi (original)
+++ lxml/trunk/src/lxml/proxy.pxi Tue Jul 3 23:15:04 2007
@@ -28,6 +28,7 @@
assert c_node._private is NULL, "double registering proxy!"
c_node._private = <void*>proxy
# additional INCREF to make sure _Document is GC-ed LAST!
+ proxy._gc_doc = <python.PyObject*>proxy._doc
python.Py_INCREF(proxy._doc)
cdef unregisterProxy(_Element proxy):
@@ -37,7 +38,7 @@
c_node = proxy._c_node
assert c_node._private is <void*>proxy, "Tried to unregister unknown proxy"
c_node._private = NULL
- python.Py_DECREF(proxy._doc)
+ python.Py_DECREF(<object>proxy._gc_doc)
################################################################################
# temporarily make a node the root node of its document
@@ -296,6 +297,7 @@
python.Py_INCREF(doc)
python.Py_DECREF(element._doc)
element._doc = doc
+ element._gc_doc = <python.PyObject*>doc
if c_element is c_start_node:
break
@@ -318,6 +320,7 @@
python.Py_INCREF(doc)
python.Py_DECREF(element._doc)
element._doc = doc
+ element._gc_doc = <python.PyObject*>doc
if c_element is c_start_node:
break
More information about the lxml-checkins
mailing list