summaryrefslogtreecommitdiffstats
path: root/Modules/_sre.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-12-02 11:55:12 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-12-02 11:55:12 (GMT)
commitd8d1a0ab78d6bc32940462620967c2334c569752 (patch)
tree44c32ec6b7ada60f90730633f3c9c05f4cf54180 /Modules/_sre.c
parent4569467539faecd43f97e836784e0add567f4bdb (diff)
parent9a2b26748b73d604d1ec099d07e493b1ed8f020f (diff)
downloadcpython-d8d1a0ab78d6bc32940462620967c2334c569752.zip
cpython-d8d1a0ab78d6bc32940462620967c2334c569752.tar.gz
cpython-d8d1a0ab78d6bc32940462620967c2334c569752.tar.bz2
Issue #10182: The re module doesn't truncate indices to 32 bits anymore.
Patch by Serhiy Storchaka.
Diffstat (limited to 'Modules/_sre.c')
-rw-r--r--Modules/_sre.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index a8e8a67..a65afc4 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -1618,7 +1618,7 @@ sre_literal_template(int charsize, char* ptr, Py_ssize_t len)
static PyObject *
sre_codesize(PyObject* self, PyObject *unused)
{
- return Py_BuildValue("l", sizeof(SRE_CODE));
+ return PyLong_FromSize_t(sizeof(SRE_CODE));
}
static PyObject *
@@ -2435,7 +2435,7 @@ next:
return NULL;
if (subn)
- return Py_BuildValue("Ni", item, n);
+ return Py_BuildValue("Nn", item, n);
return item;
@@ -3387,7 +3387,7 @@ match_start(MatchObject* self, PyObject* args)
}
/* mark is -1 if group is undefined */
- return Py_BuildValue("i", self->mark[index*2]);
+ return PyLong_FromSsize_t(self->mark[index*2]);
}
static PyObject*
@@ -3410,7 +3410,7 @@ match_end(MatchObject* self, PyObject* args)
}
/* mark is -1 if group is undefined */
- return Py_BuildValue("i", self->mark[index*2+1]);
+ return PyLong_FromSsize_t(self->mark[index*2+1]);
}
LOCAL(PyObject*)
@@ -3560,7 +3560,7 @@ static PyObject *
match_lastindex_get(MatchObject *self)
{
if (self->lastindex >= 0)
- return Py_BuildValue("i", self->lastindex);
+ return PyLong_FromSsize_t(self->lastindex);
Py_INCREF(Py_None);
return Py_None;
}