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

Fix Sphinx warnings in the C API documentation #107298

Closed
vstinner opened this issue Jul 26, 2023 · 9 comments
Closed

Fix Sphinx warnings in the C API documentation #107298

vstinner opened this issue Jul 26, 2023 · 9 comments
Labels
docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error

Comments

@vstinner
Copy link
Member

vstinner commented Jul 26, 2023

Recently, I saw a growing numbers of Sphinx warnings displayed as annotations which make reviews harder.

I create this issue to track changes fixing warnings.

See also gh-106948 which populates nitpick_ignore of Doc/conf.py with standard C functions, variables, macros and env vars.

Linked PRs

@vstinner vstinner added type-bug An unexpected behavior, bug, or error docs Documentation in the Doc dir labels Jul 26, 2023
vstinner added a commit to vstinner/cpython that referenced this issue Jul 26, 2023
vstinner added a commit to vstinner/cpython that referenced this issue Jul 26, 2023
vstinner added a commit that referenced this issue Jul 26, 2023
vstinner added a commit to vstinner/cpython that referenced this issue Jul 26, 2023
@vstinner
Copy link
Member Author

I extracted these comments from the CI job to generate warnings locally: check.sh script.

set -Eeuo pipefail
# Build docs with the '-n' (nit-picky) option; write warnings to file
make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n -W --keep-going -w sphinx-warnings.txt" html
python Doc/tools/check-warnings.py \
  --fail-if-regression \
  --fail-if-improved

@hugovk
Copy link
Member

hugovk commented Jul 26, 2023

See also #107298 as an umbrella issue for Sphinx warnings.

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Jul 26, 2023
…references

Add targets for PyStructSequence_Desc and PyStructSequence_Field members
and macros like Py_EQ.
Fix target for Py_RETURN_RICHCOMPARE.
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Jul 26, 2023
…references

Add targets for PyStructSequence_Desc and PyStructSequence_Field members
and macros like Py_EQ.
Fix target for Py_RETURN_RICHCOMPARE.
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Jul 26, 2023
…references

Add targets for PyStructSequence_Desc and PyStructSequence_Field members
and macros like Py_EQ.
Fix target for Py_RETURN_RICHCOMPARE.
@vstinner
Copy link
Member Author

See also #107298 as an umbrella issue for Sphinx warnings.

Wait, is it the number of this issue? I'm now confused.

vstinner added a commit to vstinner/cpython that referenced this issue Jul 26, 2023
* Update Doc/tools/.nitignore
* Fix BufferedIOBase.write() link in buffer.rst
vstinner added a commit to vstinner/cpython that referenced this issue Jul 26, 2023
* Update Doc/tools/.nitignore
* Fix BufferedIOBase.write() link in buffer.rst
vstinner added a commit that referenced this issue Jul 26, 2023
* Update Doc/tools/.nitignore
* Fix BufferedIOBase.write() link in buffer.rst
vstinner added a commit to vstinner/cpython that referenced this issue Jul 26, 2023
Declare PyObject_New() and PyObject_NewVar() as macros, since they
are macros: it avoids a warning on the non existent "TYPE" type name.
@CAM-Gerlach
Copy link
Member

@vstinner I'm guessing @hugovk meant #101100 and just accidentally pasted/autocompleted the mistaken issue number

vstinner added a commit to vstinner/cpython that referenced this issue Jul 27, 2023
Declare the following functions as macros, since they are actually
macros. it avoids a warning on the non existent "TYPE" type name.

* PyMem_New()
* PyMem_Resize()
* PyModule_AddIntMacro()
* PyModule_AddStringMacro()
* PyObject_GC_New()
* PyObject_GC_NewVar()
* PyObject_New()
* PyObject_NewVar()

Add C standard C types to nitpick_ignore in Doc/conf.py:

* int64_t
* uint64_t
* uintptr_t

No longer ignore non existing "__int" type in nitpick_ignore.

Update Doc/tools/.nitignore
vstinner added a commit that referenced this issue Jul 27, 2023
Declare the following functions as macros, since they are actually
macros. It avoids a warning on "TYPE" or "macro" argument.

* PyMem_New()
* PyMem_Resize()
* PyModule_AddIntMacro()
* PyModule_AddStringMacro()
* PyObject_GC_New()
* PyObject_GC_NewVar()
* PyObject_New()
* PyObject_NewVar()

Add C standard C types to nitpick_ignore in Doc/conf.py:

* int64_t
* uint64_t
* uintptr_t

No longer ignore non existing "__int" type in nitpick_ignore.

Update Doc/tools/.nitignore
jtcave pushed a commit to jtcave/cpython that referenced this issue Jul 27, 2023
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Aug 22, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 22, 2023
…ythonGH-108258)

(cherry picked from commit d7202e4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Aug 22, 2023
…I docs (pythonGH-108258).

(cherry picked from commit d7202e4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Yhg1s pushed a commit that referenced this issue Aug 22, 2023
…GH-108258) (#108284)

gh-107298: Fix numerous ref errors and typos in the C API docs (GH-108258)
(cherry picked from commit d7202e4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
ambv pushed a commit that referenced this issue Aug 22, 2023
(cherry picked from commit d63972e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
ambv pushed a commit that referenced this issue Aug 22, 2023
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Aug 23, 2023
serhiy-storchaka added a commit that referenced this issue Aug 23, 2023
@serhiy-storchaka
Copy link
Member

I updated lists after fixing some warnings and excluded references from NEWS and automatically generated lists of all C API names.

vstinner added a commit to vstinner/cpython that referenced this issue Sep 8, 2023
Document PyAPI_DATA(), and PyAPI_FUNC() and PyMODINIT_FUNC macros in
Doc/c-api/intro.rst. This change fix Sphinx warnings in
Doc/using/configure.rst.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 10, 2023
Remove links to PyAPI_FUNC(), PyAPI_DATA() and PyMODINIT_FUNC macros
since they are not documented. These macros should only be used to
define the Python C API. They should not be used outside Python code
base.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023
Remove links to PyAPI_FUNC(), PyAPI_DATA() and PyMODINIT_FUNC macros
since they are not documented. These macros should only be used to
define the Python C API. They should not be used outside Python code
base.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023
Remove links to PyAPI_FUNC() and PyAPI_DATA() macros since they are
not documented. These macros should only be used to define the Python
C API. They should not be used outside Python code base.

Document PyMODINIT_FUNC macro.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 11, 2023
Remove links to PyAPI_FUNC() and PyAPI_DATA() macros since they are
not documented. These macros should only be used to define the Python
C API. They should not be used outside Python code base.

Document PyMODINIT_FUNC macro.
@vstinner
Copy link
Member Author

The number of Sphinx warnings in the C API documentation is way lower! I'm no longer annoyed by Sphinx warnings unrelated to my changes when I modify C code and/or C API documentation!

Thanks everybody who helped to fix these warnings. I close this issue.

vstinner added a commit to vstinner/cpython that referenced this issue Sep 13, 2023
Remove links to PyAPI_FUNC() and PyAPI_DATA() macros since they are
not documented. These macros should only be used to define the Python
C API. They should not be used outside Python code base.

Document PyMODINIT_FUNC macro.
vstinner added a commit that referenced this issue Sep 14, 2023
Document PyMODINIT_FUNC macro.

Remove links to PyAPI_FUNC() and PyAPI_DATA() macros since they are
not documented. These macros should only be used to define the Python
C API. They should not be used outside Python code base.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 27, 2023
Document PyMODINIT_FUNC macro.

Remove links to PyAPI_FUNC() and PyAPI_DATA() macros since they are
not documented. These macros should only be used to define the Python
C API. They should not be used outside Python code base.
(cherry picked from commit d7a27e5)

Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner added a commit that referenced this issue Sep 27, 2023
gh-107298: Document PyMODINIT_FUNC macro (#109236)

Document PyMODINIT_FUNC macro.

Remove links to PyAPI_FUNC() and PyAPI_DATA() macros since they are
not documented. These macros should only be used to define the Python
C API. They should not be used outside Python code base.

(cherry picked from commit d7a27e5)
Yhg1s pushed a commit that referenced this issue Sep 27, 2023
gh-107298: Document PyMODINIT_FUNC macro (GH-109236)

Document PyMODINIT_FUNC macro.

Remove links to PyAPI_FUNC() and PyAPI_DATA() macros since they are
not documented. These macros should only be used to define the Python
C API. They should not be used outside Python code base.
(cherry picked from commit d7a27e5)

Co-authored-by: Victor Stinner <vstinner@python.org>
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 type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants