diff options
author | Guido van Rossum <guido@python.org> | 2001-09-19 01:13:10 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-09-19 01:13:10 (GMT) |
commit | 638059603ca96a1e9b6d05f4d5c51a06a17b63ec (patch) | |
tree | 5e73d5d40ab7c5befda32c1b1533d91b07a1e93d /Objects/complexobject.c | |
parent | 50fda6c21fac39e440815acf75149e1e420cf4d7 (diff) | |
download | cpython-638059603ca96a1e9b6d05f4d5c51a06a17b63ec.zip cpython-638059603ca96a1e9b6d05f4d5c51a06a17b63ec.tar.gz cpython-638059603ca96a1e9b6d05f4d5c51a06a17b63ec.tar.bz2 |
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.
Diffstat (limited to 'Objects/complexobject.c')
-rw-r--r-- | Objects/complexobject.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/complexobject.c b/Objects/complexobject.c index a8419e3..a2ccadb 100644 --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -538,6 +538,11 @@ complex_coerce(PyObject **pv, PyObject **pw) Py_INCREF(*pv); return 0; } + else if (PyComplex_Check(*pw)) { + Py_INCREF(*pv); + Py_INCREF(*pw); + return 0; + } return 1; /* Can't do it */ } |