Skip to content

Mypy does not accept mmap object in re.match #1467

Description

@libre-man

It seems that the re.compile types are to restrictive, the following code errors in mypy but running it is no problem:

# _txt_fmt is a object gotten from `re.compile`withopen(file, 'r+') asf:
withmmap.mmap(f.fileno(), 0) asdata:
match=_txt_fmt.match(data)

Mypy gives the error Argument 1 to "match" of "Pattern" has incompatible type "mmap"; expected "bytes".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions