Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve complex C-API error descriptions #121834

Closed
sobolevn opened this issue Jul 16, 2024 · 0 comments
Closed

Improve complex C-API error descriptions #121834

sobolevn opened this issue Jul 16, 2024 · 0 comments
Assignees
Labels
docs Documentation in the Doc dir topic-C-API

Comments

@sobolevn
Copy link
Member

sobolevn commented Jul 16, 2024

There several things to improve:

  • Some functions do not have an error description at all:
    .. c:function:: PyObject* PyComplex_FromCComplex(Py_complex v)
    Create a new Python complex number object from a C :c:type:`Py_complex` value.
    .. c:function:: PyObject* PyComplex_FromDoubles(double real, double imag)
    Return a new :c:type:`PyComplexObject` object from *real* and *imag*.
    So, we should add that these functions can fail.
  • Some functions mention the error case, but do not mention that exception is set:
    to :meth:`~object.__index__`. Upon failure, this method returns ``-1.0`` as a real
    value.

Plus, I would unify the wording in some other functions.

Linked PRs

@sobolevn sobolevn added docs Documentation in the Doc dir topic-C-API labels Jul 16, 2024
@sobolevn sobolevn self-assigned this Jul 16, 2024
sobolevn added a commit to sobolevn/cpython that referenced this issue Jul 16, 2024
sobolevn added a commit that referenced this issue Jul 17, 2024
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 17, 2024
(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>
sobolevn added a commit to sobolevn/cpython that referenced this issue Jul 17, 2024
(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>
sobolevn added a commit that referenced this issue Jul 17, 2024
gh-121834: Improve `complex` C-API docs (GH-121835)
(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>
sobolevn added a commit that referenced this issue Jul 17, 2024
* [3.12] gh-121834: Improve `complex` C-API docs (GH-121835)
(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>
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 topic-C-API
Projects
None yet
Development

No branches or pull requests

1 participant