diff options
author | Sergey B Kirpichev <skirpichev@gmail.com> | 2024-01-15 18:04:17 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-15 16:04:17 +0100 |
commit | 0f2fa6150baf111a6c69d5d491c95c3c2ee60eaf (patch) | |
tree | e60136c4ac8da4e44cd3bdf4a702372be34a96d1 /Python/symtable.c | |
parent | ac10947ba79a15bfdaa3ca92c6864214648ab364 (diff) | |
download | cpython-0f2fa6150baf111a6c69d5d491c95c3c2ee60eaf.tar.gz cpython-0f2fa6150baf111a6c69d5d491c95c3c2ee60eaf.zip |
gh-109598: make PyComplex_RealAsDouble/ImagAsDouble use __complex__ (GH-109647)
`PyComplex_RealAsDouble()`/`PyComplex_ImagAsDouble` now try to convert
an object to a `complex` instance using its `__complex__()` method
before falling back to the ``__float__()`` method.
PyComplex_ImagAsDouble() also will not silently return 0.0 for
non-complex types anymore. Instead we try to call PyFloat_AsDouble()
and return 0.0 only if this call is successful.
Diffstat (limited to 'Python/symtable.c')
0 files changed, 0 insertions, 0 deletions