mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
SF # 669553, fix memory (ref) leaks
Will backport.
This commit is contained in:
parent
f4ca5a2f45
commit
fa56e2dc40
2 changed files with 32 additions and 13 deletions
|
|
@ -606,9 +606,16 @@ int_neg(PyIntObject *v)
|
|||
a = v->ob_ival;
|
||||
x = -a;
|
||||
if (a < 0 && x < 0) {
|
||||
PyObject *o;
|
||||
if (err_ovf("integer negation"))
|
||||
return NULL;
|
||||
return PyNumber_Negative(PyLong_FromLong(a));
|
||||
o = PyLong_FromLong(a);
|
||||
if (o != NULL) {
|
||||
PyObject *result = PyNumber_Negative(o);
|
||||
Py_DECREF(o);
|
||||
return result;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong(x);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue