Skip to content

[BUG]: Incorrect type hints for older versions #5660

Closed
@gentlegiantJGC

Description

@gentlegiantJGC

Required prerequisites

What version (or hash if on master) of pybind11 are you using?

05a6a03

Problem description

A number of the type hints have been updated for never versions of Python but are now incorrect for older versions of Python.
An example is collections.abc.Buffer which was added in Python 3.12 however there are many more examples.

If an extension is compiled against an older version of Python the stub files generated will be incorrect for that version and a static type checker will correctly throw errors.

I would expect the type hints to be correct for the version of Python the extension was compiled against regardless of which version it is.

Reproducible example code


Is this a regression? Put the last known working version here if it is.

Not a regression

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNew bug, unverified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions