[PyQt] SIP: Suggestions for a new major version

Phil Thompson phil at riverbankcomputing.com
Thu Apr 14 08:47:58 BST 2011


On Thu, 14 Apr 2011 01:28:48 +0200, Jens Thoms Toerring <jt at toerring.de>
wrote:
> Hi,
> 
>    there are what I feel are a few rough edges to SIP were
> I'd be very happy if a new major version would improve on
> it.
> 
> One of these points is that SIP does balk at some legal C++
> syntax. E.g. it doesn't want to understand types like 'long
> int', it only accepts 'long' (same for 'short int').
> 
> And then SIP insists on the 'const' qualifier coming before
> the type name and complains about "invalid syntax" when you
> have it the other way round. E.g. it accepts 'const char *'
> but not 'char const *'.
> 
> Our in-house coding standard requests using in C++ just the
> forms that SIP doesn't like (the "type name first and const
> qualifier afterwards" is straight from the C++ FAQ). So there
> is quite a bit of menial work when converting C++ header files
> into a .sip files that perhaps could be avoided.
> 
> Would it be a lot of work to make SIP accept alternative
> (but legal) C++ syntax? I would be quite willing to spend
> a bit of time on trying to get that implemented but I would
> need some pointers to were to start looking since I haven't
> spend a lot of time yet going through the SIP source code.

What's needed is a complete C++ parser.

> Another problem I have run into quite often is error messages
> of the form
> 
> sip: xxx::yyy() has overloaded functions with the same Python signature
> 
> While I'm aware that Python's type system is quite different
> from C++'s that always gives me a sinking feeling since I know
> that finding the offending line(s) will cost me lots of time.
> While I may have overlooked something in the documentation and
> thus haven't yet groked the rules of what exactly are functions
> "with the same Python signature" (I once thought I had got a
> handle on it but then the next case squashed that hope;-), that
> there are no line number in the error message to give me a star-
> ting point on where to look also doesn't help too much;-) The
> only way to find the offending lines I have at the moment is to
> comment out lots of stuff in the .sip file, retry, uncomment a
> few lines, try again etc. until SIP finally is satisfied. That
> works but is rather time consuming and then I'm not really happy
> when I don't understand what I'm doing and have to rely on trial-
> and-error...

This is covered in the SIP v5 roadmap.

Phil


More information about the PyQt mailing list