This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2020年07月12日 14:23 by mdehoon, last changed 2022年04月11日 14:59 by admin. This issue is now closed.
| Messages (6) | |||
|---|---|---|---|
| msg373554 - (view) | Author: Michiel de Hoon (mdehoon) * | Date: 2020年07月12日 14:23 | |
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 - 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? |
|||
| msg373601 - (view) | Author: Inada Naoki (methane) * (Python committer) | Date: 2020年07月13日 12:56 | |
Would you be more specific about why you need that feature on the Python-ideas mailing list or "Ideas" category on discuss.python.org? |
|||
| msg373668 - (view) | Author: Michiel de Hoon (mdehoon) * | Date: 2020年07月15日 06:39 | |
Thank you, I have posted an explanation in the "Ideas" category of discuss.python.org. |
|||
| msg373693 - (view) | Author: Stefan Krah (skrah) * (Python committer) | Date: 2020年07月15日 13:26 | |
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. |
|||
| msg373697 - (view) | Author: Michiel de Hoon (mdehoon) * | Date: 2020年07月15日 14:13 | |
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. |
|||
| msg373705 - (view) | Author: Stefan Krah (skrah) * (Python committer) | Date: 2020年07月15日 17:36 | |
Yes, let's make #13797 a superseder. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:59:33 | admin | set | github: 85457 |
| 2020年07月15日 17:38:42 | skrah | set | status: open -> closed superseder: Allow objects implemented in pure Python to export PEP 3118 buffers resolution: duplicate stage: resolved |
| 2020年07月15日 17:36:54 | skrah | set | messages: + msg373705 |
| 2020年07月15日 14:13:53 | mdehoon | set | messages: + msg373697 |
| 2020年07月15日 13:26:51 | skrah | set | messages: + msg373693 |
| 2020年07月15日 06:39:52 | mdehoon | set | messages: + msg373668 |
| 2020年07月13日 12:56:04 | methane | set | nosy:
+ methane messages: + msg373601 |
| 2020年07月12日 16:08:26 | christian.heimes | set | versions: - Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 |
| 2020年07月12日 14:37:24 | xtreak | set | nosy:
+ skrah |
| 2020年07月12日 14:23:24 | mdehoon | create | |