summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-04-19 14:50:15 (GMT)
committerThomas Wouters <thomas@python.org>2006-04-19 14:50:15 (GMT)
commit4abb3660ca43ffa22e1879dac238c2ed7c406389 (patch)
tree471b76cdc2afb69fe3b4e2212646659bd324bb20 /Objects
parent67191311299c7c4097981c961064080824f09f9c (diff)
downloadcpython-4abb3660ca43ffa22e1879dac238c2ed7c406389.zip
cpython-4abb3660ca43ffa22e1879dac238c2ed7c406389.tar.gz
cpython-4abb3660ca43ffa22e1879dac238c2ed7c406389.tar.bz2
Use Py_ssize_t to hold the 'width' argument to the ljust, rjust, center and
zfill stringmethods, so they can create strings larger than 2Gb on 64bit systems (even win64.) The unicode versions of these methods already did this right.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/stringobject.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index ef3b825..a0c6a53 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -2860,10 +2860,10 @@ PyDoc_STRVAR(ljust__doc__,
static PyObject *
string_ljust(PyStringObject *self, PyObject *args)
{
- int width;
+ Py_ssize_t width;
char fillchar = ' ';
- if (!PyArg_ParseTuple(args, "i|c:ljust", &width, &fillchar))
+ if (!PyArg_ParseTuple(args, "n|c:ljust", &width, &fillchar))
return NULL;
if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) {
@@ -2884,10 +2884,10 @@ PyDoc_STRVAR(rjust__doc__,
static PyObject *
string_rjust(PyStringObject *self, PyObject *args)
{
- int width;
+ Py_ssize_t width;
char fillchar = ' ';
- if (!PyArg_ParseTuple(args, "i|c:rjust", &width, &fillchar))
+ if (!PyArg_ParseTuple(args, "n|c:rjust", &width, &fillchar))
return NULL;
if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) {
@@ -2909,10 +2909,10 @@ static PyObject *
string_center(PyStringObject *self, PyObject *args)
{
Py_ssize_t marg, left;
- long width;
+ Py_ssize_t width;
char fillchar = ' ';
- if (!PyArg_ParseTuple(args, "l|c:center", &width, &fillchar))
+ if (!PyArg_ParseTuple(args, "n|c:center", &width, &fillchar))
return NULL;
if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) {
@@ -2938,9 +2938,9 @@ string_zfill(PyStringObject *self, PyObject *args)
Py_ssize_t fill;
PyObject *s;
char *p;
+ Py_ssize_t width;
- long width;
- if (!PyArg_ParseTuple(args, "l:zfill", &width))
+ if (!PyArg_ParseTuple(args, "n:zfill", &width))
return NULL;
if (PyString_GET_SIZE(self) >= width) {