From b22c556079e11b68f1274c97a1980a366b74e671 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Fri, 26 Jan 2024 12:55:22 +0300 Subject: [PATCH 1/3] gh-101100: Fix sphinx warnings in `c-api/file.rst` (GH-114546) (cherry picked from commit 01d970c1b8acf3ccf199d5de151a635ffd9d8c61) Co-authored-by: Nikita Sobolev Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- Doc/c-api/file.rst | 9 +++++++-- Doc/c-api/object.rst | 8 ++++++++ Doc/tools/.nitignore | 2 -- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Doc/c-api/file.rst b/Doc/c-api/file.rst index b36c800e00444a..0a03841e467cad 100644 --- a/Doc/c-api/file.rst +++ b/Doc/c-api/file.rst @@ -65,8 +65,13 @@ the :mod:`io` APIs instead. Overrides the normal behavior of :func:`io.open_code` to pass its parameter through the provided handler. - The handler is a function of type :c:expr:`PyObject *(\*)(PyObject *path, - void *userData)`, where *path* is guaranteed to be :c:type:`PyUnicodeObject`. + The handler is a function of type: + + .. c:type:: Py_OpenCodeHookFunction + + Equivalent of :c:expr:`PyObject *(\*)(PyObject *path, + void *userData)`, where *path* is guaranteed to be + :c:type:`PyUnicodeObject`. The *userData* pointer is passed into the hook function. Since hook functions may be called from different runtimes, this pointer should not diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst index d88de7944859b7..a5ee14c71a5b90 100644 --- a/Doc/c-api/object.rst +++ b/Doc/c-api/object.rst @@ -19,6 +19,14 @@ Object Protocol to NotImplemented and return it). +.. c:macro:: Py_PRINT_RAW + + Flag to be used with multiple functions that print the object (like + :c:func:`PyObject_Print` and :c:func:`PyFile_WriteObject`). + If passed, these function would use the :func:`str` of the object + instead of the :func:`repr`. + + .. c:function:: int PyObject_Print(PyObject *o, FILE *fp, int flags) Print an object *o*, on file *fp*. Returns ``-1`` on error. The flags argument diff --git a/Doc/tools/.nitignore b/Doc/tools/.nitignore index b4c18a44ef67ac..bfaece8c869adf 100644 --- a/Doc/tools/.nitignore +++ b/Doc/tools/.nitignore @@ -5,7 +5,6 @@ Doc/c-api/arg.rst Doc/c-api/descriptor.rst Doc/c-api/exceptions.rst -Doc/c-api/file.rst Doc/c-api/float.rst Doc/c-api/gcsupport.rst Doc/c-api/init.rst @@ -13,7 +12,6 @@ Doc/c-api/init_config.rst Doc/c-api/intro.rst Doc/c-api/memoryview.rst Doc/c-api/module.rst -Doc/c-api/object.rst Doc/c-api/stable.rst Doc/c-api/sys.rst Doc/c-api/type.rst From 4f224b6651226ecf844bed3159f754db98d4f03e Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sun, 4 Feb 2024 11:31:13 +0300 Subject: [PATCH 2/3] Update .nitignore --- Doc/tools/.nitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/tools/.nitignore b/Doc/tools/.nitignore index bfaece8c869adf..a3efe7b089b4ea 100644 --- a/Doc/tools/.nitignore +++ b/Doc/tools/.nitignore @@ -13,6 +13,7 @@ Doc/c-api/intro.rst Doc/c-api/memoryview.rst Doc/c-api/module.rst Doc/c-api/stable.rst +Doc/c-api/object.rst Doc/c-api/sys.rst Doc/c-api/type.rst Doc/c-api/typeobj.rst From ef87c104b270f34d020019ad75e04e53da3303d4 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sun, 4 Feb 2024 11:31:33 +0300 Subject: [PATCH 3/3] Update .nitignore --- Doc/tools/.nitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/tools/.nitignore b/Doc/tools/.nitignore index a3efe7b089b4ea..ac10182795f531 100644 --- a/Doc/tools/.nitignore +++ b/Doc/tools/.nitignore @@ -12,8 +12,8 @@ Doc/c-api/init_config.rst Doc/c-api/intro.rst Doc/c-api/memoryview.rst Doc/c-api/module.rst -Doc/c-api/stable.rst Doc/c-api/object.rst +Doc/c-api/stable.rst Doc/c-api/sys.rst Doc/c-api/type.rst Doc/c-api/typeobj.rst