[PyQt] Re: Bug ovverriding sizeHint

Phil Thompson phil at riverbankcomputing.co.uk
Mon Feb 25 15:46:48 GMT 2008


On Monday 25 February 2008, Giovanni Bajo wrote:
> On 2/25/2008 3:28 PM, Phil Thompson wrote:
> > 2. Patching will have no effect if the virtual has already been invoked
> > (because there is an internal cache).
>
> Thanks for your change, but this is a showstopper for me, so I guess I
> will have to find a different solution. Specifically, I would also need
> to remove the attribute and readd it later, etc.
> (The GC issue also worries me, but I have not analyzed its implications
> in details).
>
> I'm mentioning because, if you are not comfortable with this change, you
> might want to simply back it out as I'm not going to excercise it.

I've already made a note to myself in the comments to consider removing the 
cache. It avoids a GIL acquire/release and an attribute lookup each time C++ 
invokes a virtual.

(I've just noticed that the GIL is acquired and released in the common case 
where there is no Python reimplementation - now fixed.)

You can experiment with disabling the cache if you want (just remove the call 
that sets the flag when the cache has been filled). I'd remove the cache if 
was proved not to be of significant benefit.

Phil


More information about the PyQt mailing list