]> granicus.if.org Git - python/commitdiff
Use correct PyArg_Parse format char for Py_ssize_t in unicode.center().
authorThomas Wouters <thomas@python.org>
Thu, 16 Feb 2006 19:34:37 +0000 (19:34 +0000)
committerThomas Wouters <thomas@python.org>
Thu, 16 Feb 2006 19:34:37 +0000 (19:34 +0000)
Fixes:

>>> u"".center(10)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
MemoryError

on 64-bit systems.

Objects/unicodeobject.c

index eaf98372c8ee8e37ff120af9466e8f9b3b870190..d353f1fc7aa98d8ea821feed6282dc929bdc7769 100644 (file)
@@ -4853,7 +4853,7 @@ unicode_center(PyUnicodeObject *self, PyObject *args)
     Py_ssize_t width;
     Py_UNICODE fillchar = ' ';
 
-    if (!PyArg_ParseTuple(args, "i|O&:center", &width, convert_uc, &fillchar))
+    if (!PyArg_ParseTuple(args, "n|O&:center", &width, convert_uc, &fillchar))
         return NULL;
 
     if (self->length >= width && PyUnicode_CheckExact(self)) {