-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
gh-141004: Document Py_RETURN_NAN and Py_RETURN_INF
#141029
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
gh-141004: Document Py_RETURN_NAN and Py_RETURN_INF
#141029
Conversation
Py_RETURN_NAN and Py_RETURN_INF
|
Macro docs should generally include the expansion (perhaps simplified). |
|
Unfortunately, that's a little tricky here, because the definition involves Take a look at something like |
I disagree there. I think it's clear as mud to someone who'd see it for the first time.
The expansion can be approximate -- it should illustrate the concept for to C programmers, and be a hint for the non-C ones (who generally can't use headers and need to reimplement macros). But I'd also be fine with |
I agree, we shouldn't use pure-Python world equivalents.
See issue thread on fate of such macros. I hope we could reference to INFINITY/NAN from the C standard. |
|
Ok, I've updated it to include the macro expansion using C99's |
|
Note that neither macro is used in the CPython codebase. Do we need them at all? Both |
Co-authored-by: Sergey B Kirpichev <[email protected]>
Is it used in any third parties? (We should document the macro nonetheless, but perhaps we could deprecate it.) |
It seems so, I see few matches in the Github search. Though, nothing that can't be replaced by something like |
|
If there's actual usage, I don't see why we need to deprecate these at all. They don't pose a maintenance issue. |
|
Ok, I'm going to merge this. @encukou, if you'd like to deprecate these, let's do that in a separate PR for 3.15 only. I personally don't see any need to deprecate them. |
|
Thanks @ZeroIntensity for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…GH-141029) (cherry picked from commit 5b02c6e) Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Sergey B Kirpichev <[email protected]>
|
GH-141074 is a backport of this pull request to the 3.14 branch. |
…GH-141029) (cherry picked from commit 5b02c6e) Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Sergey B Kirpichev <[email protected]>
|
GH-141075 is a backport of this pull request to the 3.13 branch. |
…1029) (GH-141074) gh-141004: Document `Py_RETURN_NAN` and `Py_RETURN_INF` (GH-141029) (cherry picked from commit 5b02c6e) Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Sergey B Kirpichev <[email protected]>
…1029) (GH-141075) gh-141004: Document `Py_RETURN_NAN` and `Py_RETURN_INF` (GH-141029) (cherry picked from commit 5b02c6e) Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Sergey B Kirpichev <[email protected]>
…GH-141029) Co-authored-by: Sergey B Kirpichev <[email protected]>
📚 Documentation preview 📚: https://cpython-previews--141029.org.readthedocs.build/en/141029/c-api/float.html#c.Py_RETURN_NAN