Skip to content

doc page for struct.unpack_from has a spurious argument #155406

Description

@altoplano

Documentation

The page:
https://docs.python.org/3/library/struct.html

describes:

struct.unpack_from(format, /, buffer, offset=0)
    Unpack from buffer starting at position offset, according to the format string format. The result is a tuple even if it contains exactly one item. The buffer’s size in bytes, starting at position offset, must be at least the size required by the format, as reflected by [calcsize()](https://docs.python.org/3/library/struct.html#struct.calcsize). A negative offset counts from the end of buffer.

pretty sure the second argument is not real and the first line should read:

struct.unpack_from(format, buffer, offset=0)

This would match the calls made to the struct.unpack_from function in the test code at:
https://github.com/python/cpython/blob/3.14/Lib/test/test_struct.py

;;peter aka altoplano

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions