[PyQt] /In,Out/ annotation for "const char *&"

Phil Thompson phil at riverbankcomputing.com
Mon May 15 14:33:40 BST 2017


On 8 May 2017, at 6:59 pm, Shaheed Haque <srhaque at theiet.org> wrote:
> 
> Hi,
> 
> I have the following method in C++:
> 
> bool parseAtom(const char *&scursor, const char* send, QString &result, bool allow8Bit = false);
> 
> The first argument,scursor, is both input to and output from the method. (The third is also output, but is not relevant to this note). When I add the annotations like this:
> 
> bool parseAtom(const char *&scursor /In,Out/, const char* send, QString &result, bool allow8Bit = false);
> 
> The generated docstring looks plausible:
> 
> parseAtom(str, str, str, bool = False) -> Tuple[bool, str]
> 
> but the generated code does not compile because it is passed using "&" when I think it should not be:
> 
> const char* a0;
> ...
> if (sipParseArgs(&sipParseErr, sipArgs, "csJ1|b", &a0, &a1, sipType_QString,&a2, &a2State, &a3))
> {
> ...
> sipRes = ::KMime::HeaderParsing::parseAtom(&a0,a1,*a2,a3);

Can you check if the attached patch gives you what you expect?

Phil

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sip.patch
Type: application/octet-stream
Size: 3467 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170515/0f1e3348/attachment.obj>


More information about the PyQt mailing list