[issue41285] memoryview does not support subclassing

2020-07-15 Thread Stefan Krah


Change by Stefan Krah :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Allow objects implemented in pure Python to export PEP 3118 
buffers

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41285] memoryview does not support subclassing

2020-07-15 Thread Stefan Krah


Stefan Krah  added the comment:

Yes, let's make #13797 a superseder.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41285] memoryview does not support subclassing

2020-07-15 Thread Michiel de Hoon


Michiel de Hoon  added the comment:

You are correct, this is indeed a duplicate of #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.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41285] memoryview does not support subclassing

2020-07-15 Thread Stefan Krah


Stefan Krah  added the comment:

If I understand this correctly, I think this may be a duplicate of #13797.


Something like a __getbuffer__ protocol would be needed. I'm not
saying we *should* go that route, just stating the requirements
from my perspective.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41285] memoryview does not support subclassing

2020-07-15 Thread Michiel de Hoon


Michiel de Hoon  added the comment:

Thank you, I have posted an explanation in the "Ideas" category of 
discuss.python.org.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41285] memoryview does not support subclassing

2020-07-13 Thread Inada Naoki


Inada Naoki  added the comment:

Would you be more specific about why you need that feature on the Python-ideas 
mailing list or "Ideas" category on discuss.python.org?

--
nosy: +inada.naoki

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41285] memoryview does not support subclassing

2020-07-12 Thread Christian Heimes


Change by Christian Heimes :


--
versions:  -Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41285] memoryview does not support subclassing

2020-07-12 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +skrah

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41285] memoryview does not support subclassing

2020-07-12 Thread Michiel de Hoon


New submission from Michiel de Hoon :

Currently memoryview does not support subclassing:

>>> class B(memoryview): pass
... 
Traceback (most recent call last):
  File "", line 1, in 
TypeError: type 'memoryview' is not an acceptable base type


Subclassing memoryview can be useful when
- class A supports the buffer protocol;
- class B wraps class A and should support the buffer protocol provided by 
class A;
- class A does not support subclassing.

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?

--
components: C API
messages: 373554
nosy: mdehoon
priority: normal
severity: normal
status: open
title: memoryview does not support subclassing
type: enhancement
versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com