summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-01-05 10:00:36 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2006-01-05 10:00:36 (GMT)
commitdea59e5755526be328aa6d330ce730e387a7562d (patch)
treeb2b05d27be8170b1e28df4d570e1e12b41946d9f /Objects
parentc6d1f9100f8cb80dec5b1a454d3bdb54f6f76f98 (diff)
downloadcpython-dea59e5755526be328aa6d330ce730e387a7562d.zip
cpython-dea59e5755526be328aa6d330ce730e387a7562d.tar.gz
cpython-dea59e5755526be328aa6d330ce730e387a7562d.tar.bz2
Stop maintaining the buildno file.
Also, stop determining Unicode sizes with PyString_GET_SIZE.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index b850559..15d647e 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -5357,7 +5357,7 @@ unicode_islower(PyUnicodeObject *self)
return PyBool_FromLong(Py_UNICODE_ISLOWER(*p));
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -5391,7 +5391,7 @@ unicode_isupper(PyUnicodeObject *self)
return PyBool_FromLong(Py_UNICODE_ISUPPER(*p) != 0);
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -5428,7 +5428,7 @@ unicode_istitle(PyUnicodeObject *self)
(Py_UNICODE_ISUPPER(*p) != 0));
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -5473,7 +5473,7 @@ unicode_isspace(PyUnicodeObject *self)
return PyBool_FromLong(1);
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -5502,7 +5502,7 @@ unicode_isalpha(PyUnicodeObject *self)
return PyBool_FromLong(1);
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -5531,7 +5531,7 @@ unicode_isalnum(PyUnicodeObject *self)
return PyBool_FromLong(1);
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -5560,7 +5560,7 @@ unicode_isdecimal(PyUnicodeObject *self)
return PyBool_FromLong(1);
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -5589,7 +5589,7 @@ unicode_isdigit(PyUnicodeObject *self)
return PyBool_FromLong(1);
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -5618,7 +5618,7 @@ unicode_isnumeric(PyUnicodeObject *self)
return PyBool_FromLong(1);
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -6453,14 +6453,14 @@ unicode_subscript(PyUnicodeObject* self, PyObject* item)
if (PyInt_Check(item)) {
long i = PyInt_AS_LONG(item);
if (i < 0)
- i += PyString_GET_SIZE(self);
+ i += PyUnicode_GET_SIZE(self);
return unicode_getitem(self, i);
} else if (PyLong_Check(item)) {
long i = PyLong_AsLong(item);
if (i == -1 && PyErr_Occurred())
return NULL;
if (i < 0)
- i += PyString_GET_SIZE(self);
+ i += PyUnicode_GET_SIZE(self);
return unicode_getitem(self, i);
} else if (PySlice_Check(item)) {
int start, stop, step, slicelength, cur, i;
@@ -6468,7 +6468,7 @@ unicode_subscript(PyUnicodeObject* self, PyObject* item)
Py_UNICODE* result_buf;
PyObject* result;
- if (PySlice_GetIndicesEx((PySliceObject*)item, PyString_GET_SIZE(self),
+ if (PySlice_GetIndicesEx((PySliceObject*)item, PyUnicode_GET_SIZE(self),
&start, &stop, &step, &slicelength) < 0) {
return NULL;
}
@@ -6478,6 +6478,9 @@ unicode_subscript(PyUnicodeObject* self, PyObject* item)
} else {
source_buf = PyUnicode_AS_UNICODE((PyObject*)self);
result_buf = PyMem_MALLOC(slicelength*sizeof(Py_UNICODE));
+
+ if (result_buf == NULL)
+ return PyErr_NoMemory();
for (cur = start, i = 0; i < slicelength; cur += step, i++) {
result_buf[i] = source_buf[cur];