text: mark florisson, 02.03.2012 17:33: > On 2 March 2012 10:09, Stefan Behnel wrote: >>); I asked on python-dev and I think this assert will be removed. There is now a ticket to allow buffer redirection by "__getbuffer__()" as a general feature. >> return (PyObject *)mbuf; >> } >> """ >> >> Note the assertion (which is unreleased as of now, so it may still be >> subject to changes). Is there any reason the value should be set to None by >> Cython's special casing code instead of self? > > It sets it to None to it can later reset it to NULL. Python 3.3 is the > first version to document the 'obj' Py_buffer attribute, and it > mentions that the exporter may set it to NULL. I don't find it very clear on that part, though. The way I read it, NULL is only to be set on error (which Cython does already). > The code above is not > the PyObject_GetBuffer function, so setting it to NULL should still > work. Defaulting it to 'self' instead would work equally well I'd > think. I'll wait and see what the discussion on python-dev brings up. If the outcome is that NULL is for errors and that it should have a value otherwise, I think 'self' is a better default. Stefan