-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Mypy does not accept mmap
object in re.match
#1467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
stubs: false positive
Type checkers report false errors
Comments
Full example: import mmap
import re
with open("...", 'r+') as f:
with mmap.mmap(f.fileno(), 0) as data:
match = re.compile(b"").match(data) The mmap documentation explicitly mentions the interaction with re: "You can use mmap objects in most places where bytearray are expected; for example, you can use the re module to search through a memory-mapped file." So I believe we should fix this. |
jonathanslenders
added a commit
to jonathanslenders/typeshed
that referenced
this issue
May 27, 2019
jonathanslenders
added a commit
to jonathanslenders/typeshed
that referenced
this issue
May 27, 2019
Hello. Any update on this? |
PR welcome! |
I'd like to work on this. |
Should be fixed with #7679. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems that the
re.compile
types are to restrictive, the following code errors in mypy but running it is no problem:Mypy gives the error
Argument 1 to "match" of "Pattern" has incompatible type "mmap"; expected "bytes"
.The text was updated successfully, but these errors were encountered: