[Pyrex] C versus Python access

Robert Bradshaw robertwb at math.washington.edu
Thu Nov 1 09:18:52 CET 2007


On Oct 31, 2007, at 4:15 PM, Robert Bradshaw wrote:

> On Oct 31, 2007, at 3:37 PM, Greg Ewing wrote:
>
>> More seriously, it looks like it will fail if the overriding
>> method tries to call the inherited method. This will call
>> the wrapper, which will pick up the overriding method and
>> call it again, leading to infinite recursion.
>
> Good point. Short of warning people to avoid this flaw, one could
> maybe look at the traceback to detect where one was called from, or
> perhaps add a dispatcher function (is called by the vtable entry, but
> skipped in the wrapper function). Of course this would add an extra
> function call so is less than ideal... I'll have to think about this;
> do you have any ideas?

Thanks for catching this. I ended up making a global flag that you  
can set right before calling when you want it to skip the dispatching  
code. I could think of only two instances where one would want this:  
in the def wrapper itself and when explicitly doing ClassName.foo 
(self, ...). All works as expected now, and it should still be plenty  
fast.

- Robert





More information about the Pyrex mailing list