diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 2 | ||||
-rw-r--r-- | Python/ceval.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index a6e02bed2d..85fd58ecee 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 d3a732a62e..86ee6cfc23 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); |