Skip to content

Replace IndexError with OverflowError in struct.pack_into() #143904

Closed

Description

@serhiy-storchaka

Feature or enhancement

struct.pack_into() raises IndexError if the offset argument is too large for Py_ssize_t. It was introduced in 75c3d6f (bpo-3694), because PyLong_AsSsize_t() at that time raised SystemError for non-long. This is the only IndexError in the module -- struct.unpack_from() raises OverflowError. There were no tests for this, I only added tests just now (PR #143901).

Linked PRs

Activity

  1. added a commit that references this issue on Jan 16, 2026
  2. added a commit that references this issue on Feb 1, 2026
  3. added a commit that references this issue on Feb 3, 2026
  4. added a commit that references this issue on Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.15bugs and security fixesextension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions