Skip to content

Commit 26c659e

Browse files
miss-islingtonshreyanavigyaniritkatrielerlend-aasland
authored
[3.12] pythongh-87969: Align docs and docstrings with implementation for ctypes' [w]string_at() (pythonGH-25384) (pythonGH-118046)
pythongh-87969: Align docs and docstrings with implementation for ctypes' [w]string_at() (pythonGH-25384) The implementation uses 'ptr' for the name of the first parameter of ctypes.string_at() and ctypes.wstring_at(). Align docs and docstrings with the naming used in the implementation. (cherry picked from commit 81a926b) Co-authored-by: Shreyan Avigyan <[email protected]> Co-authored-by: Irit Katriel <[email protected]> Co-authored-by: Erlend E. Aasland <[email protected]>
1 parent f278b8f commit 26c659e

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

Doc/library/ctypes.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,13 +2072,13 @@ Utility functions
20722072
Does the same as the C ``sizeof`` operator.
20732073

20742074

2075-
.. function:: string_at(address, size=-1)
2075+
.. function:: string_at(ptr, size=-1)
20762076

2077-
This function returns the C string starting at memory address *address* as a bytes
2078-
object. If size is specified, it is used as size, otherwise the string is assumed
2077+
Return the byte string at *void \*ptr*.
2078+
If *size* is specified, it is used as size, otherwise the string is assumed
20792079
to be zero-terminated.
20802080

2081-
.. audit-event:: ctypes.string_at address,size ctypes.string_at
2081+
.. audit-event:: ctypes.string_at ptr,size ctypes.string_at
20822082

20832083

20842084
.. function:: WinError(code=None, descr=None)
@@ -2094,14 +2094,14 @@ Utility functions
20942094
alias of :exc:`OSError`.
20952095

20962096

2097-
.. function:: wstring_at(address, size=-1)
2097+
.. function:: wstring_at(ptr, size=-1)
20982098

2099-
This function returns the wide character string starting at memory address
2100-
*address* as a string. If *size* is specified, it is used as the number of
2099+
Return the wide-character string at *void \*ptr*.
2100+
If *size* is specified, it is used as the number of
21012101
characters of the string, otherwise the string is assumed to be
21022102
zero-terminated.
21032103

2104-
.. audit-event:: ctypes.wstring_at address,size ctypes.wstring_at
2104+
.. audit-event:: ctypes.wstring_at ptr,size ctypes.wstring_at
21052105

21062106

21072107
.. _ctypes-data-types:

Lib/ctypes/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,9 @@ def cast(obj, typ):
519519

520520
_string_at = PYFUNCTYPE(py_object, c_void_p, c_int)(_string_at_addr)
521521
def string_at(ptr, size=-1):
522-
"""string_at(addr[, size]) -> string
522+
"""string_at(ptr[, size]) -> string
523523
524-
Return the string at addr."""
524+
Return the byte string at void *ptr."""
525525
return _string_at(ptr, size)
526526

527527
try:
@@ -531,9 +531,9 @@ def string_at(ptr, size=-1):
531531
else:
532532
_wstring_at = PYFUNCTYPE(py_object, c_void_p, c_int)(_wstring_at_addr)
533533
def wstring_at(ptr, size=-1):
534-
"""wstring_at(addr[, size]) -> string
534+
"""wstring_at(ptr[, size]) -> string
535535
536-
Return the string at addr."""
536+
Return the wide-character string at void *ptr."""
537537
return _wstring_at(ptr, size)
538538

539539

0 commit comments

Comments
 (0)