Mercurial > cpython-lru_cache-weakref
diff Objects/longobject.c @ 33328:fee592fb5643 legacy-trunk
long_pow(): Fix more instances of leaks in error cases.
Bugfix candidate -- although long_pow() is so different now I doubt a
patch would apply to 2.3.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Mon, 30 Aug 2004 02:58:59 +0000 |
| parents | 5452d4ecddd0 |
| children | 30d428f992f9 |
line wrap: on
line diff
--- a/Objects/longobject.c Mon Aug 30 02:44:38 2004 +0000 +++ b/Objects/longobject.c Mon Aug 30 02:58:59 2004 +0000 @@ -2343,7 +2343,7 @@ if (c) { PyErr_SetString(PyExc_TypeError, "pow() 2nd argument " "cannot be negative when 3rd argument specified"); - return NULL; + goto Error; } else { /* else return a float. This works because we know @@ -2361,7 +2361,7 @@ if (c->ob_size == 0) { PyErr_SetString(PyExc_ValueError, "pow() 3rd argument cannot be 0"); - goto Done; + goto Error; } /* if modulus < 0: @@ -2390,7 +2390,7 @@ Having the base positive just makes things easier. */ if (a->ob_size < 0) { if (l_divmod(a, c, NULL, &temp) < 0) - goto Done; + goto Error; Py_DECREF(a); a = temp; temp = NULL;
