summaryrefslogtreecommitdiffstats
path: root/Modules/_sre.c
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2001-10-21 18:04:11 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2001-10-21 18:04:11 (GMT)
commit1296a8d77e6701d18090c24853cd098f12ef069a (patch)
tree6b23bb96d99a6a016738468514be09dfbacf3f0d /Modules/_sre.c
parentbec95b9d8825b39cff46a8c645fa0eeb8409854e (diff)
downloadcpython-1296a8d77e6701d18090c24853cd098f12ef069a.zip
cpython-1296a8d77e6701d18090c24853cd098f12ef069a.tar.gz
cpython-1296a8d77e6701d18090c24853cd098f12ef069a.tar.bz2
sre.Scanner fixes (from Greg Chapman). also added a Scanner sanity
check to the test suite. added a few missing exception checks in the _sre module
Diffstat (limited to 'Modules/_sre.c')
-rw-r--r--Modules/_sre.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index be93d93..3a2d47c 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -1800,6 +1800,11 @@ join(PyObject* list, PyObject* pattern)
return NULL;
}
args = PyTuple_New(1);
+ if (!args) {
+ Py_DECREF(function);
+ Py_DECREF(joiner);
+ return NULL;
+ }
PyTuple_SET_ITEM(args, 0, list);
result = PyObject_CallObject(function, args);
Py_DECREF(args); /* also removes list */
@@ -1896,6 +1901,10 @@ pattern_findall(PatternObject* self, PyObject* args, PyObject* kw)
return NULL;
list = PyList_New(0);
+ if (!list) {
+ state_fini(&state);
+ return NULL;
+ }
while (state.start <= state.end) {
@@ -1995,6 +2004,10 @@ pattern_split(PatternObject* self, PyObject* args, PyObject* kw)
return NULL;
list = PyList_New(0);
+ if (!list) {
+ state_fini(&state);
+ return NULL;
+ }
n = 0;
last = state.start;
@@ -2110,6 +2123,10 @@ pattern_subx(PatternObject* self, PyObject* template, PyObject* string,
return NULL;
list = PyList_New(0);
+ if (!list) {
+ state_fini(&state);
+ return NULL;
+ }
n = i = 0;