Fixed None reference leaks in TreeBuilder class (reported by Neal

Norwitz)
This commit is contained in:
Fredrik Lundh 2005-12-18 13:58:25 +00:00
parent 7c460740ed
commit 0149e3a090
1 changed files with 4 additions and 0 deletions

View File

@ -1501,10 +1501,12 @@ treebuilder_handle_start(TreeBuilderObject* self, PyObject* tag,
if (self->data) {
if (self->this == self->last) {
Py_DECREF(self->last->text);
self->last->text = JOIN_SET(
self->data, PyList_CheckExact(self->data)
);
} else {
Py_DECREF(self->last->tail);
self->last->tail = JOIN_SET(
self->data, PyList_CheckExact(self->data)
);
@ -1606,10 +1608,12 @@ treebuilder_handle_end(TreeBuilderObject* self, PyObject* tag)
if (self->data) {
if (self->this == self->last) {
Py_DECREF(self->last->text);
self->last->text = JOIN_SET(
self->data, PyList_CheckExact(self->data)
);
} else {
Py_DECREF(self->last->tail);
self->last->tail = JOIN_SET(
self->data, PyList_CheckExact(self->data)
);