Skip to content

42 in "some string" fails at runtime with TypeError but is allowed in typeshed #2937

Closed
@ilevkivskyi

Description

@ilevkivskyi

str.__contains__() is annotated as accepting object, but in fact it only accepts strings. Fixing the annotation will require a # type: ignore since this will be an incompatible override.

There is a similar problem with bytes.__contains__(), it only accepts int and bytes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    stubs: false negativeType checkers do not report an error, but should

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions