summaryrefslogtreecommitdiff
path: root/Modules/_sre.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-01-14 03:31:43 +0000
committerGuido van Rossum <guido@python.org>2007-01-14 03:31:43 +0000
commitb0fee2cad44bf56ad9483ed0f42c29af83cb9485 (patch)
tree1ab48f8213d1de96d7297b9b5bf49c6d1944b31e /Modules/_sre.c
parentf5cbf060c80ed8ccb219ce77a819bf57ae8a073f (diff)
downloadcpython-b0fee2cad44bf56ad9483ed0f42c29af83cb9485.tar.gz
Merged the int/long unification branch, by very crude means (sorry Thomas!).
I banged on the code (beyond what's in that branch) to make fewer tests fail; the only tests that fail now are: test_descr -- can't pickle ints?! test_pickletools -- ??? test_socket -- See python.org/sf/1619659 test_sqlite -- ??? I'll deal with those later.
Diffstat (limited to 'Modules/_sre.c')
-rw-r--r--Modules/_sre.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index a24f2868c5..d402965951 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -2688,8 +2688,7 @@ _compile(PyObject* self_, PyObject* args)
for (i = 0; i < n; i++) {
PyObject *o = PyList_GET_ITEM(code, i);
- unsigned long value = PyInt_Check(o) ? (unsigned long)PyInt_AsLong(o)
- : PyLong_AsUnsignedLong(o);
+ unsigned long value = PyLong_AsUnsignedLong(o);
self->code[i] = (SRE_CODE) value;
if ((unsigned long) self->code[i] != value) {
PyErr_SetString(PyExc_OverflowError,
@@ -2763,6 +2762,10 @@ match_getindex(MatchObject* self, PyObject* index)
{
Py_ssize_t i;
+ if (index == NULL)
+ /* Default value */
+ return 0;
+
if (PyInt_Check(index))
return PyInt_AsSsize_t(index);
@@ -2913,7 +2916,7 @@ match_start(MatchObject* self, PyObject* args)
{
Py_ssize_t index;
- PyObject* index_ = Py_False; /* zero */
+ PyObject* index_ = NULL;
if (!PyArg_UnpackTuple(args, "start", 0, 1, &index_))
return NULL;
@@ -2936,7 +2939,7 @@ match_end(MatchObject* self, PyObject* args)
{
Py_ssize_t index;
- PyObject* index_ = Py_False; /* zero */
+ PyObject* index_ = NULL;
if (!PyArg_UnpackTuple(args, "end", 0, 1, &index_))
return NULL;
@@ -2986,7 +2989,7 @@ match_span(MatchObject* self, PyObject* args)
{
Py_ssize_t index;
- PyObject* index_ = Py_False; /* zero */
+ PyObject* index_ = NULL;
if (!PyArg_UnpackTuple(args, "span", 0, 1, &index_))
return NULL;