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

Hans-Peter Jansen hpj at urpla.net
Thu Mar 15 13:56:31 GMT 2018


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_.

> def exec_(self, p_str=None): # real signature unknown; restored from
> __doc__ with multiple overloads
>     """
>     exec_(self, str) -> bool
>     exec_(self) -> bool
>     """
>     return False
> 
> 
> ​This means ​that you can only invoke the no-parameter
> http://doc.qt.io/qt-5/qsqlquery.html#exec-1 via `exec_()` and not `exec()`,
> which I didn't understand when trying to call it.
> 
> Is this required/intentional?

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


More information about the PyQt mailing list