From ea53e5e1630e95f523009583184ff0b8cb6c921b Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Tue, 8 Aug 2023 11:19:02 +0200 Subject: [PATCH 1/4] Docs: Improve wording of ctypes.pointer and ctypes.POINTER --- Doc/library/ctypes.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index 474359a5cd98bd..cef688746d740e 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -2029,18 +2029,18 @@ Utility functions specifying an address, or a ctypes instance. -.. function:: POINTER(type) +.. function:: POINTER(type, /) - This factory function creates and returns a new ctypes pointer type. Pointer - types are cached and reused internally, so calling this function repeatedly is - cheap. *type* must be a ctypes type. + Create and return a new ctypes pointer type. Pointer types are cached and + reused internally, so calling this function repeatedly is cheap. *type* + must be a ctypes type. -.. function:: pointer(obj) - - This function creates a new pointer instance, pointing to *obj*. The returned - object is of the type ``POINTER(type(obj))``. +.. function:: pointer(obj, /) + Create a new pointer instance, pointing to *obj*. + The returned object is of the type ``POINTER(type(obj))``. + Note: If you just want to pass a pointer to an object to a foreign function call, you should use ``byref(obj)`` which is much faster. From c5e28569b3610c639c8c80ca06b9ff0150206dc7 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Fri, 11 Aug 2023 19:55:28 +0100 Subject: [PATCH 2/4] Wrapping --- Doc/library/ctypes.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index cef688746d740e..9cf5f707f1b1c3 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -2032,8 +2032,8 @@ Utility functions .. function:: POINTER(type, /) Create and return a new ctypes pointer type. Pointer types are cached and - reused internally, so calling this function repeatedly is cheap. *type* - must be a ctypes type. + reused internally, so calling this function repeatedly is cheap. + *type* must be a ctypes type. .. function:: pointer(obj, /) From e75360c7f5e7fa62b31b7e9d6a20412f775bc17c Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Fri, 11 Aug 2023 19:58:55 +0100 Subject: [PATCH 3/4] Remove trailing whitespace --- Doc/library/ctypes.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index 9cf5f707f1b1c3..db81aacbcfd90a 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -2040,7 +2040,6 @@ Utility functions Create a new pointer instance, pointing to *obj*. The returned object is of the type ``POINTER(type(obj))``. - Note: If you just want to pass a pointer to an object to a foreign function call, you should use ``byref(obj)`` which is much faster. From 495680ff0466eac07d020cf416fac183bf17e2a4 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Fri, 11 Aug 2023 19:59:22 +0100 Subject: [PATCH 4/4] Restore line break --- Doc/library/ctypes.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index db81aacbcfd90a..8af609d53ff4b8 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -2040,6 +2040,7 @@ Utility functions Create a new pointer instance, pointing to *obj*. The returned object is of the type ``POINTER(type(obj))``. + Note: If you just want to pass a pointer to an object to a foreign function call, you should use ``byref(obj)`` which is much faster.