Details
Description
The setProperty and property have a name argument.
- This argument is declared as byte in QtCore.pyi.
- Passing a byte to these functions will crash the app.
- However, passing a string works as expected.
Please fix the QtCore.pyi and set the type of the name to be a string, so that the Python typing module doesn't report errors.
This is a simple example that crashes for me when using a byte value for name.
engine = QQmlApplicationEngine() root = engine.rootContext() engine.load(".../main.qml") if not engine.rootObjects(): sys.exit(-1)}}{{window = engine.rootObjects()[0] window.setProperty('visible', True) # this returns a 'typing error', but it runs ok window.setProperty(b'visible', True) # this doesn't return a 'typing error', but the app crashes
This is the error I get when passing name as a byte:
Traceback (most recent call last): File "shibokensupport/signature/loader.py", line 78, in seterror_argument File "shibokensupport/signature/errorhandler.py", line 133, in seterror_argument File "shibokensupport/signature/errorhandler.py", line 97, in matched_type File "shibokensupport/signature/errorhandler.py", line 97, in <genexpr> File "shibokensupport/signature/errorhandler.py", line 72, in qt_isinstance File "/home/borco/.pyenv/versions/3.10.1/lib/python3.10/typing.py", line 374, in __getattr__ raise AttributeError(item) AttributeError: __origin__ Fatal Python error: seterror_argument did not receive a result Python runtime state: initialized Current thread 0x00007f8536456740 (most recent call first): ... Extension modules: xxsubtype, shiboken6.Shiboken, PySide6.QtCore, PySide6.QtGui, PySide6.QtNetwork, PySide6.QtQml (total: 6) fish: Job 1, '...' terminated by signal SIGABRT (Abort)