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
memoryview does not support subclassing #85457
Comments
Currently memoryview does not support subclassing: >>> class B(memoryview): pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: type 'memoryview' is not an acceptable base type Subclassing memoryview can be useful when
In this situation, class B(memoryview):
def __new__(cls, a):
return super(B, cls).__new__(cls, a) where a is an instance of class A, would let instances of B support the buffer protocol provided by a. Is there any particular reason why memoryview does not support subclassing? |
Would you be more specific about why you need that feature on the Python-ideas mailing list or "Ideas" category on discuss.python.org? |
Thank you, I have posted an explanation in the "Ideas" category of discuss.python.org. |
If I understand this correctly, I think this may be a duplicate of bpo-13797. Something like a __getbuffer__ protocol would be needed. I'm not |
You are correct, this is indeed a duplicate of bpo-13797. My apologies for not finding this issue before opening a new one. If there are no objections, I will close this issue as a duplicate. |
Yes, let's make bpo-13797 a superseder. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: