[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Getting a list of virtual PyQt functions
From:       Florian Bruhin <me () the-compiler ! org>
Date:       2015-07-16 16:39:17
Message-ID: 20150716163917.GI18503 () tonks
[Download RAW message or body]

This is a MIME-formatted message.  If you see this text it means that your
E-mail software does not support MIME-formatted messages.

[Attachment #2 (multipart/signed)]
This is a MIME-formatted message.  If you see this text it means that your
E-mail software does not support MIME-formatted messages.

[Attachment #4 (multipart/mixed)]


* Phil Thompson <phil@riverbankcomputing.com> [2015-07-16 17:27:45 +0100]:
> On 16/07/2015 10:49 am, Florian Bruhin wrote:
> >Hi!
> >
> >I recently found out about vulture[1], which is a static checker to
> >find dead Python code, among other things it finds methods which never
> >are called.
> >
> >However, it (naturally) doesn't detect when I'm overriding a virtual
> >Qt function, as that's never called *from Python*.
> >
> >I opened an issue [2] and we agreed it'd be a good idea to add a
> >whitelist for all virtual PyQt methods.
> >
> >Of course maintaining such a whitelist by hand is not something I want
> >to do, so I looked into sip and how it could help me.
> >
> >I found out about the XML export (-m), and have two questions about
> >it:
> >
> >- Is there a reason it's not documented at [3]?
> >
> >- Would a patch adding a 'virtual="true"' attribute to function tags
> >  if isVirtual() is true be appreciated?
> 
> It's not documented because it's not supported. I plan to support it (or,
> more likely, something similar) for sip5.
> 
> I would accept a patch because that is useful information to the Python
> programmer. However I make no promises about whether the current extracts
> are correct, or if they might change in the future (before they are
> officially supported).

That's okay - for my use case, the output doesn't need to be perfect.
It's a good starting point for sure.

I attached a patch. I only did it for xmlOverload as I think it's not
useful information for xmlCtor.

Thanks!

Florian

-- 
http://www.the-compiler.org | me@the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
         I love long mails! | http://email.is-not-s.ms/

["sip_virtual.patch" (text/x-diff)]

diff -ur sip-4.16.9-snapshot-4f7ad0a4e353/sipgen/export.c \
                sip-4.16.9-snapshot-4f7ad0a4e353.new/sipgen/export.c
--- sip-4.16.9-snapshot-4f7ad0a4e353/sipgen/export.c    2015-01-03 03:30:02.000000000 \
                +0100
+++ sip-4.16.9-snapshot-4f7ad0a4e353.new/sipgen/export.c        2015-07-16 \
18:35:12.188401777 +0200 @@ -612,6 +612,11 @@
         fprintf(fp, "\"");
     }
 
+    if (isVirtual(od))
+    {
+        fprintf(fp, " virtual=\"1\"");
+    }
+
     if (xtnds != NULL)
     {
         fprintf(fp, " extends=\"");


[Attachment #8 (application/pgp-signature)]
[Attachment #9 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic