gh-141004: Document Py_RETURN_NAN and Py_RETURN_INF#141029
gh-141004: Document Py_RETURN_NAN and Py_RETURN_INF#141029ZeroIntensity merged 4 commits intopython:mainfrom
Py_RETURN_NAN and Py_RETURN_INF#141029Conversation
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 <skirpichev@gmail.com>
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 <zintensitydev@gmail.com> Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
|
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 <zintensitydev@gmail.com> Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
|
GH-141075 is a backport of this pull request to the 3.13 branch. |
…GH-141029) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
📚 Documentation preview 📚: https://cpython-previews--141029.org.readthedocs.build/en/141029/c-api/float.html#c.Py_RETURN_NAN