You can just fill the last two fields of PyBufferProcs
but you have to add the Py_TPFLAGS_HAVE_NEWBUFFER
flag to the tp_flags
of your types.
This is the special thing that was introduced in python2 to make the new protocol available together with the old one.
I have no idea why this isn't documented anywhere, but you can see it used in the definition of the bytearray
type for python 2.7 (see here):
&bytearray_as_buffer, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_NEWBUFFER, /* tp_flags */
This content was already posted in comments, but it deserves an answer.