On Wed, 20 Aug 2008, Dag Sverre Seljebotn wrote: > Hi, > > this discussion was interesting. While I may seem to have en edge below > I mean it all for the sake of the discussion and hope we can continue to > have this "in a good spirit".
Yes, me too. Buffer support is a huge and wonderful feature, but given its scope and newness I am sure there is room for improvement. Thanks for bringing this up. > (Inserting this note was easier than redoing my mail. I'm excited, not > angry :-) ) > > Andrew Straw wrote: >> Dag Sverre Seljebotn wrote: >> >>> Andrew Straw wrote: >>> >>> >>>> Hi, >>>> >>>> I tracked down an issue that was giving me segfaults with a poor >>>> __getbuffer__ implementation and modified the compiler to catch this case. >>>> >>>> >>> Background first: >>> >>> The situation is that this patch guards against returning erronous data >>> from a GetBuffer call. According to the PEP (3118), I think it is pretty >>> clear that data should either be set or an exception raised, so this >>> patch only helps detect when you create an invalid __getbuffer__ >>> implementation. >>> >>> >> I understand your reasoning, but Cython's __getbuffer__ works outside >> the scope of PEP 3118. The PEP doesn't specify Cython behavior, and a >> > Only when the C file is compiled under Python 2.x. When compiling the C > file under Python 3, __getbuffer__ fills in the slot specified by the PEP. > >> great aspect of Cython, IMO, is that it makes Python/C bridges easier, >> not to adhere to the minimum standards specified by a PEP. Thus a small >> amount of additional error checking seems OK to me. Also, as another >> > Well, in this case, the error check should be done by inserting some > code automatically in the definition of __getbuffer__, so that Python 3 > consumers also get advantage of it, and so that we don't second guess > how good non-Cython implementations are. So the check is still inserted > in the wrong place. I agree, this is the right place to put the check. And I think it is very worth the (relatively small) overhead to insert a check here. - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
