[PyQt] Query on signature of %VirtualCatcherCode

Shaheed Haque srhaque at theiet.org
Fri May 5 23:13:10 BST 2017


The patch, applied to 4.19.2, seems to work fine. Would you like me to
file a bug or ...?

On 5 May 2017 at 14:58, Phil Thompson <phil at riverbankcomputing.com> wrote:
> On 4 May 2017, at 9:00 am, Shaheed Haque <srhaque at theiet.org> wrote:
>>
>> Hi,
>>
>> I am trying to generate the correct SIP %VirtualCatcherCode for this method:
>>
>>    Syndication::SpecificDocumentPtr parse(
>>        const Syndication::DocumentSource &source) const Q_DECL_OVERRIDE;
>>
>> At present the SIP looks like this:
>>
>>    virtual Syndication::SpecificDocument *parse(const
>> Syndication::DocumentSource &source) const
>>        [QSharedPointer<Syndication::SpecificDocument> (const
>> Syndication::DocumentSource &source)];
>> %MethodCode
>> ...
>> %End
>> %VirtualCatcherCode
>> ...
>> %End
>>
>> And SIP generates the following prototype for the virtual catcher code:
>>
>> =================
>> QSharedPointer<Syndication::SpecificDocument>
>> sipVH_Atom_0(sip_gilstate_t sipGILState, sipVirtErrorHandlerFunc
>> sipErrorHandler, sipSimpleWrapper *sipPySelf, PyObject *sipMethod,
>> const Syndication::DocumentSource& a0)
>> {
>>    QSharedPointer<Syndication::SpecificDocument> sipRes = 0;
>>    int sipIsErr = 0;
>> ...
>> =================
>>
>> The C++ compiler, not unreasonably, complains about the initialisation
>> of sipRes with an integer 0. Now, I suspect the real culprit here is
>> the QSharedPointer. AFAIK, this (and its various related classes) has
>> no direct representation in PyQt5; this is reflected in the use of the
>> dual-signature Python-versus-C++ facility in SIP and the %MethodCode I
>> generate.
>>
>> I'm just trying to figure out what I need to write in my
>> %VirtualCatcherCode, but it is not clear to me how to handle this
>> error. Have I misunderstood the SIP dual-signature thing as it applies
>> in this case?
>>
>> Any insights gratefully received.
>
> It's a bug - triggered by the returned value being a template.
>
> Patch attached.
>
> Phil
>


More information about the PyQt mailing list