diff options
author | Walter Dörwald <walter@livinglogic.de> | 2002-04-15 13:36:47 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2002-04-15 13:36:47 (GMT) |
commit | 068325ef926538a30d7feb13f9b14a6163e24b6e (patch) | |
tree | c2eef78d030be1ce7a56b56420ba13a853aab57d /Objects/unicodeobject.c | |
parent | b384c7263928cc2d8dd16cac8537839673cd4982 (diff) | |
download | cpython-068325ef926538a30d7feb13f9b14a6163e24b6e.zip cpython-068325ef926538a30d7feb13f9b14a6163e24b6e.tar.gz cpython-068325ef926538a30d7feb13f9b14a6163e24b6e.tar.bz2 |
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)
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 7d917bd..361612b 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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 |