Making typedef available in python module with SIP

Phil Thompson phil at riverbankcomputing.com
Mon Apr 12 11:01:36 BST 2021


On 12/04/2021 10:35, Marian Thomsen wrote:
> Hello,
> 
> how can I make a typedef available in python module with SIP?
> 
> I imagine it is simple but I cannot find a way to access test2 from my
> python module. Renaming it using /PyName=test2/ in test1 would be
> possible but is not what I want because I couldn't access test1
> anymore.
> 
> The following code is in my c++ header file:
> 
> struct test1 : public other_struct {
> ...
> };
> 
> typedef test1 test2;
> 
> I can access test1, but how to wrap test2 that I can use test1 and
> test2 in Python I do not know.
> 
> (I get: AttributeError: module 'test' has noc attribute 'test2')

Handle it in Python code by putting...

test2 = test1

...somewhere convenient.

Phil


More information about the PyQt mailing list