[Python-checkins] r42425 - python/trunk/Objects/unicodeobject.c

thomas.wouters python-checkins at python.org
Thu Feb 16 20:34:43 CET 2006


Author: thomas.wouters
Date: Thu Feb 16 20:34:37 2006
New Revision: 42425

Modified:
   python/trunk/Objects/unicodeobject.c
Log:

Use correct PyArg_Parse format char for Py_ssize_t in unicode.center().
Fixes:

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

on 64-bit systems.



Modified: python/trunk/Objects/unicodeobject.c
==============================================================================
--- python/trunk/Objects/unicodeobject.c	(original)
+++ python/trunk/Objects/unicodeobject.c	Thu Feb 16 20:34:37 2006
@@ -4853,7 +4853,7 @@
     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)) {


More information about the Python-checkins mailing list