[PyQt] Incorrect code generated for signals in nested classes, patch included

Shaheed Haque srhaque at theiet.org
Sun Jul 30 17:22:31 BST 2017


Hi,

The attached one-liner patch addresses an issue in 4.19.4.dev1707221302 where

namespace Solid
{
...
    class Battery: Solid::DeviceInterface
    {
...
    Q_SIGNALS:
...
        void chargeStateChanged(int newState, const QString &udi = QString());

ends up emitting code where sipCpp is declared like this:

    Solid_Battery *sipCpp = reinterpret_cast<Solid_Battery *>(sipCppV);

instead of this:

    Solid::Battery *sipCpp = reinterpret_cast<Solid::Battery *>(sipCppV);

The fix is to change the formatting code in the call to prcode:

=================
$ diff -U5 gencode.c.original gencode.c
--- gencode.c.original  2017-07-30 17:03:23.645851963 +0100
+++ gencode.c   2017-07-30 17:11:56.763179090 +0100
@@ -10509,11 +10509,11 @@

                 prcode(fp,
 "static int emit_%L_%s(void *sipCppV, PyObject *sipArgs)\n"
 "{\n"
 "    PyObject *sipParseErr = NULL;\n"
-"    %C *sipCpp = reinterpret_cast<%C *>(sipCppV);\n"
+"    %V *sipCpp = reinterpret_cast<%V *>(sipCppV);\n"
                     , cd->iff, od->cppname
                     , classFQCName(cd), classFQCName(cd));
             }

             /*
=================

Please consider applying.

Thanks, Shaheed


More information about the PyQt mailing list