Apply the second version of SF patch http://www.python.org/sf/536241

Add a method zfill to str, unicode and UserString and change
Lib/string.py accordingly.

This activates the zfill version in unicodeobject.c that was
commented out and implements the same in stringobject.c. It also
adds the test for unicode support in Lib/string.py back in and
uses repr() instead() of str() (as it was before Lib/string.py 1.62)
This commit is contained in:
Walter Dörwald 2002-04-15 13:36:47 +00:00
parent b384c72639
commit 068325ef92
8 changed files with 83 additions and 13 deletions

View file

@ -4824,7 +4824,6 @@ unicode_upper(PyUnicodeObject *self)
return fixup(self, fixupper);
}
#if 0
static char zfill__doc__[] =
"S.zfill(width) -> unicode\n\
\n\
@ -4850,6 +4849,9 @@ unicode_zfill(PyUnicodeObject *self, PyObject *args)
u = pad(self, fill, 0, '0');
if (u == NULL)
return NULL;
if (u->str[fill] == '+' || u->str[fill] == '-') {
/* move sign to beginning of string */
u->str[0] = u->str[fill];
@ -4858,7 +4860,6 @@ unicode_zfill(PyUnicodeObject *self, PyObject *args)
return (PyObject*) u;
}
#endif
#if 0
static PyObject*
@ -4970,8 +4971,8 @@ static PyMethodDef unicode_methods[] = {
{"isnumeric", (PyCFunction) unicode_isnumeric, METH_NOARGS, isnumeric__doc__},
{"isalpha", (PyCFunction) unicode_isalpha, METH_NOARGS, isalpha__doc__},
{"isalnum", (PyCFunction) unicode_isalnum, METH_NOARGS, isalnum__doc__},
#if 0
{"zfill", (PyCFunction) unicode_zfill, METH_VARARGS, zfill__doc__},
#if 0
{"capwords", (PyCFunction) unicode_capwords, METH_NOARGS, capwords__doc__},
#endif