Kaydet (Commit) de01774d authored tarafından Thomas Wouters's avatar Thomas Wouters

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.
üst 13870b18
...@@ -4853,7 +4853,7 @@ unicode_center(PyUnicodeObject *self, PyObject *args) ...@@ -4853,7 +4853,7 @@ unicode_center(PyUnicodeObject *self, PyObject *args)
Py_ssize_t width; Py_ssize_t width;
Py_UNICODE fillchar = ' '; 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; return NULL;
if (self->length >= width && PyUnicode_CheckExact(self)) { if (self->length >= width && PyUnicode_CheckExact(self)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment