Skip to content

gh-157208: Fix the ctypes.util.struct documentation - #157209

Open
fedonman wants to merge 2 commits into
python:mainfrom
fedonman:fix-ctypes-struct-doc-example
Open

gh-157208: Fix the ctypes.util.struct documentation#157209
fedonman wants to merge 2 commits into
python:mainfrom
fedonman:fix-ctypes-struct-doc-example

Conversation

@fedonman

@fedonman fedonman commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

The anonymous-field example for @struct used Annotated, CFieldInfo, c_ssize_t and c_void_p with no imports, so copying it out of the page raised NameError; this adds the imports and indents the example body four spaces to match the example above it. It also gives layout its default in the signature line, which had rendered an optional parameter as required.

The anonymous-field example used Annotated, CFieldInfo, c_ssize_t and
c_void_p without importing any of them, so it raised NameError when
copied out of the page. Add the imports and indent the example body
four spaces to match the example above it.

The signature line showed layout without its default, rendering an
optional parameter as required.
@read-the-docs-community

read-the-docs-community Bot commented Sep 9, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34471854 | 📁 Comparing e81da50 against main (894af95)

  🔍 Preview build  

2 files changed
± library/ctypes.html
± library/curses.html

@aisk

aisk commented Sep 9, 2026

Copy link
Copy Markdown
Member

Hi, I found that some other examples in this file are also using three spaces for indentation. Could you fix them here too? Other than that, LGTM.

@wrap_dll_function(dll_to_wrap)
def function_ptr_name(arg_name: ctypes_type, ...) -> ctypes_type:
"""Optional docstring. There should be no function body."""

@wrap_dll_function(ctypes.pythonapi)
def PyObject_GetAttrString(op: ctypes.py_object, attr: ctypes.c_char_p) -> ctypes.py_object:
pass

Both examples indented the function body three spaces.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants