Commit 465fa3da authored by Tim Peters's avatar Tim Peters

complex_new(): This could leak when the argument was neither string nor

number.  This accounts for the 2 refcount leaks per test_complex run
Michael Hudson discovered (I figured only I would have the stomach to
look for leaks in floating-point code <wink>).
parent 90b182c1
......@@ -12,6 +12,9 @@ What's New in Python 2.4 alpha 1?
Core and builtins
-----------------
- complex(obj) could leak a little memory if obj wasn't a string or
number.
- zip() with no arguments now returns an empty list instead of raising
a TypeError exception.
......
......@@ -882,6 +882,9 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
((i != NULL) && (nbi == NULL || nbi->nb_float == NULL))) {
PyErr_SetString(PyExc_TypeError,
"complex() argument must be a string or a number");
if (own_r) {
Py_DECREF(r);
}
return NULL;
}
if (PyComplex_Check(r)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment