Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Constrain memoryview type var to allowed types #13683

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

srittau
Copy link
Collaborator

@srittau srittau commented Mar 20, 2025

No description provided.

Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra
Copy link
Member

I haven't fully thought this through but #13519 partially made me think that making memoryview generic with a default was a mistake. memoryview now means memoryview[int], so if you have a memoryview[bytes] you can't pass it to a function that wants a plain memoryview. But usually that's wrong; lots of memoryview functionality doesn't depend on the type parameter and lots of functions will work with any kind of memoryview.

@srittau
Copy link
Collaborator Author

srittau commented Mar 20, 2025

I was thinking about that, but I think changing the default to Any might be a better solution. That keeps the flexibility of restricting memoryviews while by default any memoryview is accepted.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants