mirror of https://github.com/python/cpython.git
needforspeed: cleanup
This commit is contained in:
parent
b947948c61
commit
c2032fb86a
|
@ -1544,8 +1544,8 @@ found, returns S and two empty strings.");
|
||||||
static PyObject *
|
static PyObject *
|
||||||
string_partition(PyStringObject *self, PyObject *sep_obj)
|
string_partition(PyStringObject *self, PyObject *sep_obj)
|
||||||
{
|
{
|
||||||
Py_ssize_t str_len = PyString_GET_SIZE(self), sep_len;
|
const char *sep;
|
||||||
const char *str = PyString_AS_STRING(self), *sep;
|
Py_ssize_t sep_len;
|
||||||
|
|
||||||
if (PyString_Check(sep_obj)) {
|
if (PyString_Check(sep_obj)) {
|
||||||
sep = PyString_AS_STRING(sep_obj);
|
sep = PyString_AS_STRING(sep_obj);
|
||||||
|
@ -1553,12 +1553,16 @@ string_partition(PyStringObject *self, PyObject *sep_obj)
|
||||||
}
|
}
|
||||||
#ifdef Py_USING_UNICODE
|
#ifdef Py_USING_UNICODE
|
||||||
else if (PyUnicode_Check(sep_obj))
|
else if (PyUnicode_Check(sep_obj))
|
||||||
return PyUnicode_Partition((PyObject *)self, sep_obj);
|
return PyUnicode_Partition((PyObject *) self, sep_obj);
|
||||||
#endif
|
#endif
|
||||||
else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len))
|
else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return partition((PyObject*)self, str, str_len, sep_obj, sep, sep_len);
|
return partition(
|
||||||
|
(PyObject*) self,
|
||||||
|
PyString_AS_STRING(self), PyString_GET_SIZE(self),
|
||||||
|
sep_obj, sep, sep_len
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_LOCAL(PyObject *)
|
Py_LOCAL(PyObject *)
|
||||||
|
|
Loading…
Reference in New Issue