Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Polishing.
  • Loading branch information
serhiy-storchaka committed May 29, 2024
commit 14598f0d567a8903c090ea77e100316a9b332997
8 changes: 3 additions & 5 deletions Objects/complexobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,8 @@ complex_new_impl(PyTypeObject *type, PyObject *r, PyObject *i)
cr = ((PyComplexObject*)r)->cval;
cr_is_complex = 1;
if (own_r) {
/* r was a newly created complex number, rather
than the original "real" argument. */
Py_DECREF(r);
}
nbr = Py_TYPE(orig_r)->tp_as_number;
Expand All @@ -1074,11 +1076,7 @@ complex_new_impl(PyTypeObject *type, PyObject *r, PyObject *i)
nothing in the imaginary direction.
Just treat it as a double. */
tmp = PyNumber_Float(r);
if (own_r) {
/* r was a newly created complex number, rather
than the original "real" argument. */
Py_DECREF(r);
}
assert(!own_r);
if (tmp == NULL)
return NULL;
assert(PyFloat_Check(tmp));
Expand Down