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

Shaheed Haque srhaque at theiet.org
Sun May 21 00:02:39 BST 2017


That seems to work nicely. Thanks Phil!

On 15 May 2017 at 14:33, Phil Thompson <phil at riverbankcomputing.com> wrote:
> 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
>


More information about the PyQt mailing list