Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0f3735b8
Commit
0f3735b8
authored
Jan 12, 2013
by
Eli Bendersky
Browse files
Options
Browse Files
Download
Plain Diff
Close #16076: fix refleak in pickling of Element.
Thanks to Ezio Melotti and Daniel Shahaf for the patch.
parents
a6ebb2d7
b8f6dc85
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
11 deletions
+5
-11
Modules/_elementtree.c
Modules/_elementtree.c
+5
-11
No files found.
Modules/_elementtree.c
View file @
0f3735b8
...
@@ -859,8 +859,10 @@ element_getstate(ElementObject *self)
...
@@ -859,8 +859,10 @@ element_getstate(ElementObject *self)
PICKLED_ATTRIB
,
self
->
extra
->
attrib
,
PICKLED_ATTRIB
,
self
->
extra
->
attrib
,
PICKLED_TEXT
,
self
->
text
,
PICKLED_TEXT
,
self
->
text
,
PICKLED_TAIL
,
self
->
tail
);
PICKLED_TAIL
,
self
->
tail
);
if
(
instancedict
)
if
(
instancedict
)
{
Py_DECREF
(
children
);
return
instancedict
;
return
instancedict
;
}
else
{
else
{
for
(
i
=
0
;
i
<
PyList_GET_SIZE
(
children
);
i
++
)
for
(
i
=
0
;
i
<
PyList_GET_SIZE
(
children
);
i
++
)
Py_DECREF
(
PyList_GET_ITEM
(
children
,
i
));
Py_DECREF
(
PyList_GET_ITEM
(
children
,
i
));
...
@@ -884,25 +886,17 @@ element_setstate_from_attributes(ElementObject *self,
...
@@ -884,25 +886,17 @@ element_setstate_from_attributes(ElementObject *self,
PyErr_SetString
(
PyExc_TypeError
,
"tag may not be NULL"
);
PyErr_SetString
(
PyExc_TypeError
,
"tag may not be NULL"
);
return
NULL
;
return
NULL
;
}
}
if
(
!
text
)
{
Py_INCREF
(
Py_None
);
text
=
Py_None
;
}
if
(
!
tail
)
{
Py_INCREF
(
Py_None
);
tail
=
Py_None
;
}
Py_CLEAR
(
self
->
tag
);
Py_CLEAR
(
self
->
tag
);
self
->
tag
=
tag
;
self
->
tag
=
tag
;
Py_INCREF
(
self
->
tag
);
Py_INCREF
(
self
->
tag
);
Py_CLEAR
(
self
->
text
);
Py_CLEAR
(
self
->
text
);
self
->
text
=
text
;
self
->
text
=
text
?
text
:
Py_None
;
Py_INCREF
(
self
->
text
);
Py_INCREF
(
self
->
text
);
Py_CLEAR
(
self
->
tail
);
Py_CLEAR
(
self
->
tail
);
self
->
tail
=
tail
;
self
->
tail
=
tail
?
tail
:
Py_None
;
Py_INCREF
(
self
->
tail
);
Py_INCREF
(
self
->
tail
);
/* Handle ATTRIB and CHILDREN. */
/* Handle ATTRIB and CHILDREN. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment