See the question linked in the comments for the list of possible reasons behind dissallowing this.
The direct technical reason has to do with how Python classes are declared in C. The interesting part is right at the bottom of bufferobject.c
:
PyTypeObject PyBuffer_Type = {
...
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GETCHARBUFFER | Py_TPFLAGS_HAVE_NEWBUFFER, /* tp_flags */
...
};
This field, tp_flags
, includes a potential setting called Py_TPFLAGS_BASETYPE
, which isn't used here. If it was, like it is in, for example, listobject.c
, inheriting from buffer
would be allowed.