FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.12] gh-121834: Improve `complex` C-API docs (GH-121835) by sobolevn · Pull Request #121897 · python/cpython · GitHub

/ cpython Public

[3.12] gh-121834: Improve complex C-API docs (GH-121835) - #121897

Merged
sobolevn merged 3 commits into
python:3.12from
sobolevn:backport-72dccd6-3.12
Jul 17, 2024
Merged

[3.12] gh-121834: Improve complex C-API docs (GH-121835)#121897
sobolevn merged 3 commits into
python:3.12from
sobolevn:backport-72dccd6-3.12

Conversation

sobolevn commented Jul 17, 2024
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Member

(cherry picked from commit 72dccd6)

Since PyComplex_RealAsDouble uses PyFloat_AsDouble, it can still fail there:

double
PyComplex_RealAsDouble(PyObject *op)
{
if (PyComplex_Check(op)) {
return ((PyComplexObject *)op)->cval.real;
}
else {
return PyFloat_AsDouble(op);
}
}

While PyComplex_ImagAsDouble is always successful:

double
PyComplex_ImagAsDouble(PyObject *op)
{
if (PyComplex_Check(op)) {
return ((PyComplexObject *)op)->cval.imag;
}
else {
return 0.0;
}
}


📚 Documentation preview 📚: https://cpython-previews--121897.org.readthedocs.build/

(cherry picked from commit 72dccd6)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>

Copy link
Copy Markdown
Member Author

cc @skirpichev

skirpichev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

One remark on PyComplex_ImagAsDouble(). The rest LGTM.

Comment thread Doc/c-api/complex.rst Outdated
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
sobolevn enabled auto-merge (squash) July 17, 2024 07:26
sobolevn merged commit 6a19d22 into python:3.12 Jul 17, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL