summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-11-26 10:30:26 (GMT)
committerGuido van Rossum <guido@python.org>1992-11-26 10:30:26 (GMT)
commitd014ea6b5efbfb3d143fc8aacf8bee733cf4c8f0 (patch)
treedc0e77dcbbf8da041a72226eda0aefbc849cd6eb /Python
parent18fc5696c8be30b56485a20dc48f7f683b472f79 (diff)
downloadcpython-d014ea6b5efbfb3d143fc8aacf8bee733cf4c8f0.zip
cpython-d014ea6b5efbfb3d143fc8aacf8bee733cf4c8f0.tar.gz
cpython-d014ea6b5efbfb3d143fc8aacf8bee733cf4c8f0.tar.bz2
* classobject.c: in instance_lenth, test result of call_object
for exception before using it. Fixed a few other places where the outcome of calling sq_length wasn't tested for exceptions (bltinmodule.c, ceval.c).
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c2
-rw-r--r--Python/ceval.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index a6e02be..85fd58e 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -412,6 +412,8 @@ min_max(v, sign)
return NULL;
}
n = (*sq->sq_length)(v);
+ if (n < 0)
+ return NULL;
if (n == 0) {
err_setstr(ValueError, "min() or max() of empty sequence");
return NULL;
diff --git a/Python/ceval.c b/Python/ceval.c
index d3a732a..86ee6cf 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1881,6 +1881,8 @@ loop_subscript(v, w)
}
i = getintvalue(w);
n = (*sq->sq_length)(v);
+ if (n < 0)
+ return NULL; /* Exception */
if (i >= n)
return NULL; /* End of loop */
return (*sq->sq_item)(v, i);