mirror of
https://github.com/python/cpython.git
synced 2025-09-03 23:41:18 +00:00
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>
This commit is contained in:
parent
a0b8b342c5
commit
6988ff02a5
17 changed files with 316 additions and 17 deletions
|
@ -72,6 +72,7 @@ _KEYWORD = textwrap.dedent(r'''
|
|||
long |
|
||||
float |
|
||||
double |
|
||||
_Complex |
|
||||
void |
|
||||
|
||||
struct |
|
||||
|
@ -121,6 +122,16 @@ SIMPLE_TYPE = textwrap.dedent(rf'''
|
|||
|
|
||||
(?: signed | unsigned ) # implies int
|
||||
|
|
||||
(?:
|
||||
(?: (?: float | double | long\s+double ) \s+ )?
|
||||
_Complex
|
||||
)
|
||||
|
|
||||
(?:
|
||||
_Complex
|
||||
(?: \s+ (?: float | double | long\s+double ) )?
|
||||
)
|
||||
|
|
||||
(?:
|
||||
(?: (?: signed | unsigned ) \s+ )?
|
||||
(?: (?: long | short ) \s+ )?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue