mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
complex_coerce(): add explicit PyComplex_Check() test. Previously,
complex_coerce() would never be called with a complex argument, because PyNumber_Coerce[Ex] doesn't bother calling the type's coercion method if the values already have the same type. But now, of course, it's possible to pass an instance of a complex *subtype*, and those must be accepted.
This commit is contained in:
parent
50fda6c21f
commit
638059603c
1 changed files with 5 additions and 0 deletions
|
@ -538,6 +538,11 @@ complex_coerce(PyObject **pv, PyObject **pw)
|
||||||
Py_INCREF(*pv);
|
Py_INCREF(*pv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else if (PyComplex_Check(*pw)) {
|
||||||
|
Py_INCREF(*pv);
|
||||||
|
Py_INCREF(*pw);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return 1; /* Can't do it */
|
return 1; /* Can't do it */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue