| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
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)
```
``ctypes.__STDC_IEC_559_COMPLEX__`` is ``0`` if compiler doesn't support
complex arithmetic (Annex G).
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
I'd prefer having a separate PR because we might need aliases in case sizeof(long double) == sizeof(double) (the same technique that is used for long long and long IIRC)
I think it might be indeed a good alternative, because otherwise you need to find good 1-char names for float complex and long double complex in the future, but I think Cf, Cd and Cl (or Cq for quad-precision) are good enough. But for that we need to update the fielddesc structure with an additional field that would be a "modifier" of some sort or allow the "code" to be more than just a single character.
I'd say in a separate PR since there is a translation of ctypes format to PEP 3118 names (where complex numbers are represented by 'Z'). |
Sorry, something went wrong.
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
|
Use a force-push only to fix typo's or revert a merge. |
Sorry, something went wrong.
Thank you for advice. Usually I don't do this. I hope this time force-push was OK, as it's restricted to unreviewed commits. |
Sorry, something went wrong.
|
It's less bad if no-one commented on those commits, but it's still more work to figure out what you changed. |
Sorry, something went wrong.
* add configure test for _Complex type * define HAVE_C_COMPLEX * move workarounds for buggy implementations to Module/_complex.h
|
Well, one failure seems to be related: Looking on the libffi sources, it seems that FFI_TYPE_COMPLEX is available unconditionally, even if platform doesn't support interfaces to _Complex (for sparc it works since v3.3). We should check FFI_TARGET_HAS_COMPLEX_TYPE instead. I'll update PR when build finish. |
Sorry, something went wrong.
|
!buildbot AMD64 Fedora Rawhide PR |
Sorry, something went wrong.
|
!buildbot AMD64 Fedora Rawhide PR |
Sorry, something went wrong.
|
Oh, Rawhide failure is unrelated: "No space left on device". |
Sorry, something went wrong.
|
!buildbot PPC64LE CentOS9 PR |
Sorry, something went wrong.
|
!buildbot PPC64LE Fedora Stable Clang PR |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @vstinner for commit 6d5bf66 🤖 The command will test the builders whose names match following regular expression: PPC64LE Fedora Stable Clang PR The builders matched are:
|
Sorry, something went wrong.
|
Thanks @skirpichev, I merged your PR. I checked remaining buildbot failures: they are unrelated to the change. @skirpichev: @erlend-aasland has concerns about relative #include. |
Sorry, something went wrong.
|
Thanks for reviews and patience.
Yep, here; I'll open an issue (I think that build failures in this pr already don't need this;)). There are other includes, besides _math.h. |
Sorry, something went wrong.
…hon#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>
…hon#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>
…hon#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>
| Back | FazBrowse Home | New Git URL |
Example:
ctypes.c_double_complex is available only if compiler does support complex arithmetic (Annex G).
📚 Documentation preview 📚: https://cpython-previews--120894.org.readthedocs.build/
Notes for reviewers: