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
5f0af23f
Commit
5f0af23f
authored
Jul 11, 2013
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #18408: _elementtree.c now handles create_extra() failure
parent
68c8ea25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
12 deletions
+24
-12
Modules/_elementtree.c
Modules/_elementtree.c
+24
-12
No files found.
Modules/_elementtree.c
View file @
5f0af23f
...
...
@@ -374,8 +374,10 @@ element_resize(ElementObject* self, int extra)
/* make sure self->children can hold the given number of extra
elements. set an exception and return -1 if allocation failed */
if
(
!
self
->
extra
)
create_extra
(
self
,
NULL
);
if
(
!
self
->
extra
)
{
if
(
create_extra
(
self
,
NULL
)
<
0
)
return
-
1
;
}
size
=
self
->
extra
->
length
+
extra
;
...
...
@@ -1267,8 +1269,10 @@ element_insert(ElementObject* self, PyObject* args)
&
Element_Type
,
&
element
))
return
NULL
;
if
(
!
self
->
extra
)
create_extra
(
self
,
NULL
);
if
(
!
self
->
extra
)
{
if
(
create_extra
(
self
,
NULL
)
<
0
)
return
NULL
;
}
if
(
index
<
0
)
{
index
+=
self
->
extra
->
length
;
...
...
@@ -1409,8 +1413,10 @@ element_set(ElementObject* self, PyObject* args)
if
(
!
PyArg_ParseTuple
(
args
,
"OO:set"
,
&
key
,
&
value
))
return
NULL
;
if
(
!
self
->
extra
)
create_extra
(
self
,
NULL
);
if
(
!
self
->
extra
)
{
if
(
create_extra
(
self
,
NULL
)
<
0
)
return
NULL
;
}
attrib
=
element_get_attrib
(
self
);
if
(
!
attrib
)
...
...
@@ -1525,8 +1531,10 @@ element_ass_subscr(PyObject* self_, PyObject* item, PyObject* value)
PyObject
*
recycle
=
NULL
;
PyObject
*
seq
=
NULL
;
if
(
!
self
->
extra
)
create_extra
(
self
,
NULL
);
if
(
!
self
->
extra
)
{
if
(
create_extra
(
self
,
NULL
)
<
0
)
return
-
1
;
}
if
(
PySlice_GetIndicesEx
(
item
,
self
->
extra
->
length
,
...
...
@@ -1756,8 +1764,10 @@ element_getattro(ElementObject* self, PyObject* nameobj)
res
=
element_get_tail
(
self
);
}
else
if
(
strcmp
(
name
,
"attrib"
)
==
0
)
{
PyErr_Clear
();
if
(
!
self
->
extra
)
create_extra
(
self
,
NULL
);
if
(
!
self
->
extra
)
{
if
(
create_extra
(
self
,
NULL
)
<
0
)
return
NULL
;
}
res
=
element_get_attrib
(
self
);
}
...
...
@@ -1790,8 +1800,10 @@ element_setattro(ElementObject* self, PyObject* nameobj, PyObject* value)
self
->
tail
=
value
;
Py_INCREF
(
self
->
tail
);
}
else
if
(
strcmp
(
name
,
"attrib"
)
==
0
)
{
if
(
!
self
->
extra
)
create_extra
(
self
,
NULL
);
if
(
!
self
->
extra
)
{
if
(
create_extra
(
self
,
NULL
)
<
0
)
return
-
1
;
}
Py_DECREF
(
self
->
extra
->
attrib
);
self
->
extra
->
attrib
=
value
;
Py_INCREF
(
self
->
extra
->
attrib
);
...
...
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