[PyQt] Missing/incorrect overload for `QSqlQuery.exec()`?

J Barchan jnbarchan at gmail.com
Thu Mar 15 14:21:08 GMT 2018


On 15 March 2018 at 14:13, Florian Bruhin <me at the-compiler.org> wrote:

> On Thu, Mar 15, 2018 at 02:56:31PM +0100, Hans-Peter Jansen wrote:
> > On Donnerstag, 15. März 2018 10:14:10 J Barchan wrote:
> > > Docs:
> > >
> > > http://doc.qt.io/qt-5/qsqlquery.html#exec
> > > http://doc.qt.io/qt-5/qsqlquery.html#exec-1
> > >
> > > Python 3 PyQt5 QtSql.py:
> > >
> > > def exec(self, p_str): # real signature unknown; restored from __doc__
> > >     """ exec(self, str) -> bool """
> > >     return False
> >
> > Don't know, where you grabbed this signature from, but since exec is a
> reserved keyword
> > in Python, you need to translate any occurrence of exec in C++
> literature to exec_.
>
> Only in Python 2.
>
> Florian
>
> --
> https://www.qutebrowser.org | me at the-compiler.org (Mail/XMPP)
>    GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
>          I love long mails! | https://email.is-not-s.ms/
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
>

​

​Thanks for that Florian.  That is why​ I wrote "Python 3" at the top.

At PyQt-for-Python-3, the old exec_() calls were replaced, or at least
complemented by, the newly-acceptable, plain exec() call all over the place.
My point is, there is an inconsistency here in the exec_()/exec() situation.

As for where I got the code from: same as always, from PyCharm I "go to
definition" and it shows me the Qt.pyi file with the definitions of what
I'm trying to call.  Which is where I notices what was going on here.  I'm
on Qt/PyQt 5.7, btw.
​


-- 
Kindest,
Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180315/f5556b14/attachment.html>


More information about the PyQt mailing list