Skip to content

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

@serhiy-storchaka

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

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions