[PyQt] Calling protected methods on objects

Simon Edwards simon at simonzone.com
Wed Sep 3 23:10:36 BST 2008


Phil Thompson wrote:
> On Mon, 01 Sep 2008 22:29:37 +0200, Simon Edwards <simon at simonzone.com>
> wrote:
>> Hello Phil,
>>
>> I'm busy working on integrating Python with Plasma in KDE 4. The API for 
>> doing network distributed applets is a bit convoluted, there is a lot of 
>> delegation of methods calls to other objects. I've hit a part where it 
>> would be really handy if I could call protected methods on objects which 
>> were not created by Python itself. SIP appears to explicitly prevent 
>> this kind of access, although I've commented out the check in 
>> getComplexCppPtr() and it appears to work fine.
>>
>> * Is there a technical reason why this is forbidden? or is it more 
>> philosophical?
>>
>> * I would like an official way in SIP to call protected 
>> methods/functions regardless of where the object came from. Perhaps, 
>> just a way to "unlock" an instance making all of its method available. 
>> Is this possible?

> I need to think this over for a bit to feel comfortable with it.

I just found a workaround lets me do what I need to do without having to 
change SIP. So, it looks like I won't need this (potentially dangerous) 
functionality for the time being.

cheers,

-- 
Simon Edwards             | KDE-NL, Guidance tools, Guarddog Firewall
simon at simonzone.com       | http://www.simonzone.com/software/
Nijmegen, The Netherlands | "ZooTV? You made the right choice."


More information about the PyQt mailing list