From 36cf1bc4a758755d65ff9b3d4c3c67a70c91e141 Mon Sep 17 00:00:00 2001 From: Peter Jiping Xie Date: Sat, 25 Mar 2023 17:12:00 +0800 Subject: [PATCH 1/2] gh-103025: fix two ctypes doc issues (GH-103026) (cherry picked from commit 0708437ad043657f992cb985fd5c37e1ac052f93) Co-authored-by: Peter Jiping Xie --- Doc/library/ctypes.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index d1922aaf165a3a..8dee367a40e1bb 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -375,8 +375,8 @@ that they can be converted to the required C data type:: .. _ctypes-calling-variadic-functions: -Calling varadic functions -^^^^^^^^^^^^^^^^^^^^^^^^^ +Calling variadic functions +^^^^^^^^^^^^^^^^^^^^^^^^^^ On a lot of platforms calling variadic functions through ctypes is exactly the same as calling functions with a fixed number of parameters. On some platforms, and in @@ -485,7 +485,7 @@ a string pointer and a char, and returns a pointer to a string:: If you want to avoid the ``ord("x")`` calls above, you can set the :attr:`argtypes` attribute, and the second argument will be converted from a -single character Python bytes object into a C char:: +single character Python bytes object into a C char: >>> strchr.restype = c_char_p >>> strchr.argtypes = [c_char_p, c_char] From 002875835ab6b4b452529bcfe2ebf6e357853fbb Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sat, 25 Mar 2023 09:42:56 +0000 Subject: [PATCH 2/2] Update Doc/library/ctypes.rst --- Doc/library/ctypes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index 8dee367a40e1bb..8d4230ae1793cb 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -485,7 +485,7 @@ a string pointer and a char, and returns a pointer to a string:: If you want to avoid the ``ord("x")`` calls above, you can set the :attr:`argtypes` attribute, and the second argument will be converted from a -single character Python bytes object into a C char: +single character Python bytes object into a C char:: >>> strchr.restype = c_char_p >>> strchr.argtypes = [c_char_p, c_char]