<div dir="ltr"><div>Will the solution also contain also change of naming in type stubs to not use a0, a1 etc but use proper descriptive names like "watched" and "event" from Qt documentation? </div><div><a href="https://doc.qt.io/qt-6/qobject.html#eventFilter">https://doc.qt.io/qt-6/qobject.html#eventFilter</a> bool QObject::eventFilter(QObject *watched, QEvent *event)<br><br></div><div>Is it also possible to stop providing annotations like QObject | None for call parameters, even if Qt documentation suggests that it can't be None (also when checking PySide6 documentation, they provide plan QObject)? <br></div><div>I see that it comes from Qt convention to pass objects as pointers, not references, but in reality I don't seen calling an event handler with None in place of Event. But type checkers still complain that the None case is not supported, which leads to writing obsolete code. </div><div><br></div><div>Regards,</div><div>Grzegorz Bokota </div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">czw., 15 paź 2026 o 23:26 Phil Thompson <<a href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>> napisał(a):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 12/10/2026 21:18, Dragan A. wrote:<br>
> Hi,<br>
> <br>
> One more stub issue, this time a general one.<br>
> <br>
> At runtime, PyQt methods don't accept required arguments as keywords:<br>
> <br>
> obj.eventFilter(a0=o, a1=e) -> TypeError: eventFilter() takes no<br>
> keyword arguments<br>
> obj.event(a0=e) -> TypeError: event() takes no <br>
> keyword<br>
> arguments<br>
> <br>
> But the stubs declare them as normal parameters, without "/":<br>
> <br>
> def eventFilter(self, a0: 'QObject|None', a1: 'QEvent|None') -> <br>
> bool:<br>
> ...<br>
> <br>
> Because of that, type checkers treat the names a0/a1 as part of the <br>
> API, and<br>
> every override that uses meaningful names is reported as incompatible<br>
> (pyright 1.1.414):<br>
> <br>
> class Filter(QObject):<br>
> def eventFilter(self, watched: QObject | None, event: QEvent |<br>
> None) -> bool: ...<br>
> <br>
> error: Method "eventFilter" overrides class "QObject" in an<br>
> incompatible manner<br>
> Parameter 2 name mismatch: base parameter is named "a0", override<br>
> parameter is named "watched"<br>
> <br>
> Users are forced to name their parameters a0, a1, ... or add ignore<br>
> comments.<br>
> The stubs themselves already contradict this: QObject.eventFilter uses<br>
> (a0, a1), while some QtWidgets overrides use (watched, event), (object,<br>
> event)<br>
> or (o, e).<br>
> <br>
> The fix is to emit "/" after the arguments that can't be passed as <br>
> keywords:<br>
> <br>
> def eventFilter(self, a0: 'QObject|None', a1: 'QEvent|None', /) -><br>
> bool: ...<br>
> def event(self, a0: 'QEvent|None', /) -> bool: ...<br>
> <br>
> This matches the runtime behavior and lets subclasses use any parameter<br>
> names.<br>
> It applies to all generated methods, not only eventFilter.<br>
> <br>
> Best regards,<br>
<br>
This will be fixed in the next SIP snapshot.<br>
<br>
Thanks,<br>
Phil<br>
</blockquote></div>