PyObject* *children;
PyObject* _children[STATIC_CHILDREN];
-
+
} ElementObjectExtra;
typedef struct {
/* use Python 2.4's list growth strategy */
size = (size >> 3) + (size < 9 ? 3 : 6) + size;
/* Coverity CID #182 size_error: Allocating 1 bytes to pointer "children"
- * which needs at least 4 bytes.
- * Although it's a false alarm always assume at least one child to
+ * which needs at least 4 bytes.
+ * Although it's a false alarm always assume at least one child to
* be safe.
*/
size = size ? size : 1;
if (self->extra->children != self->extra->_children) {
/* Coverity CID #182 size_error: Allocating 1 bytes to pointer
- * "children", which needs at least 4 bytes. Although it's a
+ * "children", which needs at least 4 bytes. Although it's a
* false alarm always assume at least one child to be safe.
*/
children = PyObject_Realloc(self->extra->children,
Py_INCREF(JOIN_OBJ(element->tail));
if (self->extra) {
-
+
if (element_resize(element, self->extra->length) < 0) {
Py_DECREF(element);
return NULL;
}
element->extra->length = self->extra->length;
-
+
}
return (PyObject*) element;
if (!element)
return NULL;
-
+
text = deepcopy(JOIN_OBJ(self->text), memo);
if (!text)
goto error;
element->tail = JOIN_SET(tail, JOIN_GET(self->tail));
if (self->extra) {
-
+
if (element_resize(element, self->extra->length) < 0)
goto error;
}
element->extra->length = self->extra->length;
-
+
}
/* add object to memo dictionary (so deepcopy won't visit it again) */
if (!self->extra)
Py_RETURN_NONE;
-
+
for (i = 0; i < self->extra->length; i++) {
PyObject* item = self->extra->children[i];
if (Element_CheckExact(item) &&
element_iter(ElementObject* self, PyObject* args)
{
PyObject* result;
-
+
PyObject* tag = Py_None;
if (!PyArg_ParseTuple(args, "|O:iter", &tag))
return NULL;
element_itertext(ElementObject* self, PyObject* args)
{
PyObject* result;
-
+
if (!PyArg_ParseTuple(args, ":itertext"))
return NULL;
if (PyUnicode_Check(nameobj))
name = _PyUnicode_AsString(nameobj);
-
+
if (name == NULL)
return NULL;
Py_INCREF(key);
tag = key;
}
-
+
/* decode universal name */
p = PyBytes_AS_STRING(tag);
value = PyUnicode_DecodeUTF8(p, size, "strict");
for (i = 0; i < 256; i++)
s[i] = i;
-
+
u = PyUnicode_Decode((char*) s, 256, name, "replace");
if (!u)
return XML_STATUS_ERROR;
PyObject_Del(self);
return NULL;
}
-
+
self->names = PyDict_New();
if (!self->names) {
PyObject_Del(self->entity);
reader = PyObject_GetAttrString(fileobj, "read");
if (!reader)
return NULL;
-
+
/* read from open file object */
for (;;) {
{NULL, NULL}
};
-static PyObject*
+static PyObject*
xmlparser_getattro(XMLParserObject* self, PyObject* nameobj)
{
if (PyUnicode_Check(nameobj)) {
" break\n"
" parser.feed(data)\n"
" self._root = parser.close()\n"
- " else:\n"
+ " else:\n"
" parser = cElementTree.XMLParser()\n"
" self._root = parser._parse(source)\n"
" return self._root\n"