diff options
author | Christian Heimes <christian@cheimes.de> | 2008-05-26 13:28:38 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-05-26 13:28:38 (GMT) |
commit | 72b710a59617ebe6dd1c41613d2c7eb81702efd9 (patch) | |
tree | cd134cc11c49ba09f50e44a9f36b69f2b0ffc893 /Modules/_elementtree.c | |
parent | 9c4756ea265b5ebd71c9ae59f3673c7cecb6f060 (diff) | |
download | cpython-72b710a59617ebe6dd1c41613d2c7eb81702efd9.zip cpython-72b710a59617ebe6dd1c41613d2c7eb81702efd9.tar.gz cpython-72b710a59617ebe6dd1c41613d2c7eb81702efd9.tar.bz2 |
Renamed PyString to PyBytes
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r-- | Modules/_elementtree.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index d237cbb..0c8bf2a 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -152,7 +152,7 @@ list_join(PyObject* list) switch (PyList_GET_SIZE(list)) { case 0: Py_DECREF(list); - return PyString_FromString(""); + return PyBytes_FromString(""); case 1: result = PyList_GET_ITEM(list, 0); Py_INCREF(result); @@ -725,9 +725,9 @@ checkpath(PyObject* tag) } return 0; } - if (PyString_Check(tag)) { - char *p = PyString_AS_STRING(tag); - for (i = 0; i < PyString_GET_SIZE(tag); i++) { + if (PyBytes_Check(tag)) { + char *p = PyBytes_AS_STRING(tag); + for (i = 0; i < PyBytes_GET_SIZE(tag); i++) { if (p[i] == '{') check = 0; else if (p[i] == '}') @@ -795,7 +795,7 @@ element_findtext(ElementObject* self, PyObject* args) if (Element_CheckExact(item) && !PyObject_Compare(item->tag, tag)) { PyObject* text = element_get_text(item); if (text == Py_None) - return PyString_FromString(""); + return PyBytes_FromString(""); Py_XINCREF(text); return text; } @@ -1584,14 +1584,14 @@ treebuilder_handle_data(TreeBuilderObject* self, PyObject* data) Py_INCREF(data); self->data = data; } else { /* more than one item; use a list to collect items */ - if (PyString_CheckExact(self->data) && Py_REFCNT(self->data) == 1 && - PyString_CheckExact(data) && PyString_GET_SIZE(data) == 1) { + if (PyBytes_CheckExact(self->data) && Py_REFCNT(self->data) == 1 && + PyBytes_CheckExact(data) && PyBytes_GET_SIZE(data) == 1) { /* expat often generates single character data sections; handle the most common case by resizing the existing string... */ - Py_ssize_t size = PyString_GET_SIZE(self->data); - if (_PyString_Resize(&self->data, size + 1) < 0) + Py_ssize_t size = PyBytes_GET_SIZE(self->data); + if (_PyBytes_Resize(&self->data, size + 1) < 0) return NULL; - PyString_AS_STRING(self->data)[size] = PyString_AS_STRING(data)[0]; + PyBytes_AS_STRING(self->data)[size] = PyBytes_AS_STRING(data)[0]; } else if (PyList_CheckExact(self->data)) { if (PyList_Append(self->data, data) < 0) return NULL; @@ -1848,7 +1848,7 @@ makeuniversal(XMLParserObject* self, const char* string) PyObject* value; /* look the 'raw' name up in the names dictionary */ - key = PyString_FromStringAndSize(string, size); + key = PyBytes_FromStringAndSize(string, size); if (!key) return NULL; @@ -1870,8 +1870,8 @@ makeuniversal(XMLParserObject* self, const char* string) break; if (i != size) { /* convert to universal name */ - tag = PyString_FromStringAndSize(NULL, size+1); - p = PyString_AS_STRING(tag); + tag = PyBytes_FromStringAndSize(NULL, size+1); + p = PyBytes_AS_STRING(tag); p[0] = '{'; memcpy(p+1, string, size); size++; @@ -1882,7 +1882,7 @@ makeuniversal(XMLParserObject* self, const char* string) } /* decode universal name */ - p = PyString_AS_STRING(tag); + p = PyBytes_AS_STRING(tag); value = PyUnicode_DecodeUTF8(p, size, "strict"); Py_DECREF(tag); if (!value) { @@ -1935,7 +1935,7 @@ expat_default_handler(XMLParserObject* self, const XML_Char* data_in, } else { PyErr_Format( PyExc_SyntaxError, "undefined entity &%s;: line %ld, column %ld", - PyString_AS_STRING(key), + PyBytes_AS_STRING(key), EXPAT(GetErrorLineNumber)(self->parser), EXPAT(GetErrorColumnNumber)(self->parser) ); @@ -2362,13 +2362,13 @@ xmlparser_parse(XMLParserObject* self, PyObject* args) return NULL; } - if (!PyString_CheckExact(buffer) || PyString_GET_SIZE(buffer) == 0) { + if (!PyBytes_CheckExact(buffer) || PyBytes_GET_SIZE(buffer) == 0) { Py_DECREF(buffer); break; } res = expat_parse( - self, PyString_AS_STRING(buffer), PyString_GET_SIZE(buffer), 0 + self, PyBytes_AS_STRING(buffer), PyBytes_GET_SIZE(buffer), 0 ); Py_DECREF(buffer); @@ -2430,7 +2430,7 @@ xmlparser_setevents(XMLParserObject* self, PyObject* args) if (event_set == Py_None) { /* default is "end" only */ - target->end_event_obj = PyString_FromString("end"); + target->end_event_obj = PyBytes_FromString("end"); Py_RETURN_NONE; } @@ -2440,9 +2440,9 @@ xmlparser_setevents(XMLParserObject* self, PyObject* args) for (i = 0; i < PyTuple_GET_SIZE(event_set); i++) { PyObject* item = PyTuple_GET_ITEM(event_set, i); char* event; - if (!PyString_Check(item)) + if (!PyBytes_Check(item)) goto error; - event = PyString_AS_STRING(item); + event = PyBytes_AS_STRING(item); if (strcmp(event, "start") == 0) { Py_INCREF(item); target->start_event_obj = item; @@ -2514,7 +2514,7 @@ xmlparser_getattr(XMLParserObject* self, char* name) char buffer[100]; sprintf(buffer, "Expat %d.%d.%d", XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION); - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } else { PyErr_SetString(PyExc_AttributeError, name); return NULL; |