]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-61103: Support double complex (_Complex) type in ctypes (#120894)
authorSergey B Kirpichev <skirpichev@gmail.com>
Mon, 1 Jul 2024 08:54:33 +0000 (11:54 +0300)
committerGitHub <noreply@github.com>
Mon, 1 Jul 2024 08:54:33 +0000 (10:54 +0200)
commit6988ff02a5741bcd04a8f46b7dd845e849557be0
tree1aaf8f531cf9f648ec1358b53e2c5d6ff001e410
parenta0b8b342c5d0b4722ad9cfe82f2630025d445f00
gh-61103: Support double complex (_Complex) type in ctypes (#120894)

Example:

```pycon
>>> import ctypes
>>> ctypes.__STDC_IEC_559_COMPLEX__
1
>>> libm = ctypes.CDLL('libm.so.6')
>>> libm.clog.argtypes = [ctypes.c_double_complex]
>>> libm.clog.restype = ctypes.c_double_complex
>>> libm.clog(1+1j)
(0.34657359027997264+0.7853981633974483j)
```

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
17 files changed:
Doc/library/ctypes.rst
Lib/ctypes/__init__.py
Lib/test/test_ctypes/test_libc.py
Lib/test/test_ctypes/test_numbers.py
Makefile.pre.in
Misc/NEWS.d/next/Library/2024-06-23-07-23-08.gh-issue-61103.ca_U_l.rst [new file with mode: 0644]
Modules/_complex.h [new file with mode: 0644]
Modules/_ctypes/_ctypes.c
Modules/_ctypes/_ctypes_test.c
Modules/_ctypes/callproc.c
Modules/_ctypes/cfield.c
Modules/_ctypes/ctypes.h
PCbuild/_ctypes_test.vcxproj
Tools/c-analyzer/c_parser/parser/_regexes.py
configure
configure.ac
pyconfig.h.in