https://github.com/python/cpython
Revision 0f2fa6150baf111a6c69d5d491c95c3c2ee60eaf authored by Sergey B Kirpichev on 15 January 2024, 15:04:17 UTC, committed by GitHub on 15 January 2024, 15:04:17 UTC
`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.
1 parent ac10947
History
Tip revision: 0f2fa6150baf111a6c69d5d491c95c3c2ee60eaf authored by Sergey B Kirpichev on 15 January 2024, 15:04:17 UTC
gh-109598: make PyComplex_RealAsDouble/ImagAsDouble use __complex__ (GH-109647)
Tip revision: 0f2fa61
File Mode Size
.azure-pipelines
.devcontainer
.github
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Programs
Python
Tools
.coveragerc -rw-r--r-- 526 bytes
.editorconfig -rw-r--r-- 206 bytes
.gitattributes -rw-r--r-- 3.7 KB
.gitignore -rw-r--r-- 2.7 KB
.mailmap -rw-r--r-- 175 bytes
.pre-commit-config.yaml -rw-r--r-- 1018 bytes
.readthedocs.yml -rw-r--r-- 1014 bytes
LICENSE -rw-r--r-- 13.6 KB
Makefile.pre.in -rw-r--r-- 108.1 KB
README.rst -rw-r--r-- 9.0 KB
aclocal.m4 -rw-r--r-- 21.5 KB
config.guess -rwxr-xr-x 48.2 KB
config.sub -rwxr-xr-x 34.4 KB
configure -rwxr-xr-x 836.5 KB
configure.ac -rw-r--r-- 227.7 KB
install-sh -rwxr-xr-x 15.0 KB
pyconfig.h.in -rw-r--r-- 52.6 KB

README.rst

back to top