Skip to content
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

type annotations for json.loads() does not exclude memoryview #10990

Closed
kovidgoyal opened this issue Nov 7, 2023 · 1 comment
Closed

type annotations for json.loads() does not exclude memoryview #10990

kovidgoyal opened this issue Nov 7, 2023 · 1 comment

Comments

@kovidgoyal
Copy link

Passing memoryview into json.loads raises a TypeError. But the type annotations do not enforce this.

Reference: python/cpython#74379

@srittau
Copy link
Collaborator

srittau commented Nov 7, 2023

Thanks for the report. This seems to be a mypy issue (python/mypy#15313). The stubs are correctly annotated as accepting str | bytes | bytearray:

def loads(
s: str | bytes | bytearray,

@srittau srittau closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants