-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
pyright does not accept Pattern[AnyStr]
#4534
Comments
This won't work given the way The fix for this would require an additional overload within the typeshed stubs. Something like this: @overload
def search(self, string: AnyStr | ReadableBuffer, pos: int = ..., endpos: int = ...) -> Match[AnyStr] | None: ... Please consider reporting this issue in the typeshed issue tracker. |
Thanks, just opened the typeshed issue. |
Good news — the change was accepted into typeshed, and I've pulled the latest typeshed stubs into pyright. This issue will therefore be addressed in the next release of pyright. |
Great, thanks! |
Describe the bug
pyright does not accept
Pattern[AnyStr]
.To Reproduce
Given this test file:
pyright reports the following error:
The same code works fine if one replaces all
AnyStr
with eitherstr
orbytes
.Expected behavior
pyright should accept the example code.
VS Code extension or command-line
pyright 1.1.291, running from the command-line.
The text was updated successfully, but these errors were encountered: