mark florisson, 27.06.2012 15:03: > On 27 June 2012 13:48, Stefan Behnel wrote: >> mark florisson, 27.06.2012 14:17: >>> That works for me, as long and array is cimported from cpython (as >>> 'array' or some other name). It will patch __Pyx_GetBuffer with a >>> typecheck and a call to its __getbuffer__ method. >> >> For the memoryview_type and array_type checks, wouldn't a type identity >> test be enough instead of a PyObject_TypeCheck() ? > > Well, you want it to work for subclasses as well.
Fine with me. > I think the only > thing that doesn't work (pre-2.6), is overriding __getbuffer__ in a > subclass outside of the module or pxd. For memoryviews, since each > module has a different memoryview type, I inject a capsule in tp_dict, > which __Pyx_GetBuffer checks for (it's called __pyx_getbuffer and > __pyx_releasebuffer). I'm sure it'll be a lot of fun to rip that out when we finally drop support for Python 2.5 ... Stefan _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel