Skip to content

Type checking struct.unpack #20869

@sakgoyal

Description

@sakgoyal

Feature

Recently I made a PR for ty to allow the type checker to inspect calls to struct.unpack and return static typing instead of having to cast() or ignoring the type. I believe mypy should add this too.

astral-sh/ty#2437
astral-sh/ruff#22562

Examples:
https://github.com/astral-sh/ruff/blob/main/crates/ty_python_semantic/resources/mdtest/struct_unpack.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    featuretopic-pluginsThe plugin API and ideas for new plugins

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions