mirror of
https://github.com/python/cpython.git
synced 2025-10-03 21:55:41 +00:00
* Fix incorrect handling of signed zeros for complex-related classes.
* Add Misc/NEWS entry.
(cherry picked from commit 112ec38c15
)
This commit is contained in:
parent
66fa9d4205
commit
0936a00fe0
3 changed files with 30 additions and 3 deletions
|
@ -1014,11 +1014,11 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
return NULL;
|
||||
}
|
||||
cr.real = PyFloat_AsDouble(tmp);
|
||||
cr.imag = 0.0; /* Shut up compiler warning */
|
||||
cr.imag = 0.0;
|
||||
Py_DECREF(tmp);
|
||||
}
|
||||
if (i == NULL) {
|
||||
ci.real = 0.0;
|
||||
ci.real = cr.imag;
|
||||
}
|
||||
else if (PyComplex_Check(i)) {
|
||||
ci = ((PyComplexObject*)i)->cval;
|
||||
|
@ -1040,7 +1040,7 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
if (ci_is_complex) {
|
||||
cr.real -= ci.imag;
|
||||
}
|
||||
if (cr_is_complex) {
|
||||
if (cr_is_complex && i != NULL) {
|
||||
ci.real += cr.imag;
|
||||
}
|
||||
return complex_subtype_from_doubles(type, cr.real, ci.real);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue