Skip to content

SystemError on disconnect with pyside 6.7.1 #558

Closed
@tlambert03

Description

@tlambert03

Don't see an existing issue for this yet, so opening one. This seems related to #552, but has now turned into an exception with pyside 6.7.1:

from PySide6.QtWidgets import QLineEdit

def test_thing(qtbot):
    wdg = QLineEdit()
    qtbot.addWidget(wdg)
    with qtbot.waitSignal(wdg.textChanged):
        wdg.setText("hello")

running this test raises:

tests/test_thing.py F                                                    [100%]

=================================== FAILURES ===================================
__________________________________ test_thing __________________________________
CALL ERROR: Exceptions caught in Qt event loop:
________________________________________________________________________________
RuntimeWarning: Failed to disconnect (<bound method _AbstractSignalBlocker._quit_loop_by_timeout of <pytestqt.wait_signal.SignalBlocker object at 0x113115c50>>) from signal "timeout()".

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/talley/miniforge3/envs/superqt/lib/python3.11/site-packages/pytestqt/wait_signal.py", line 219, in _quit_loop_by_signal
    self._cleanup()
  File "/Users/talley/miniforge3/envs/superqt/lib/python3.11/site-packages/pytestqt/wait_signal.py", line 224, in _cleanup
    super()._cleanup()
  File "/Users/talley/miniforge3/envs/superqt/lib/python3.11/site-packages/pytestqt/wait_signal.py", line 66, in _cleanup
    _silent_disconnect(self._timer.timeout, self._quit_loop_by_timeout)
  File "/Users/talley/miniforge3/envs/superqt/lib/python3.11/site-packages/pytestqt/wait_signal.py", line 741, in _silent_disconnect
    signal.disconnect(slot)
SystemError: <method 'disconnect' of 'PySide6.QtCore.SignalInstance' objects> returned a result with an exception set
________________________________________________________________________________
----------------------------- Captured stderr call -----------------------------
Exceptions caught in Qt event loop:
________________________________________________________________________________
RuntimeWarning: Failed to disconnect (<bound method _AbstractSignalBlocker._quit_loop_by_timeout of <pytestqt.wait_signal.SignalBlocker object at 0x113115c50>>) from signal "timeout()".

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/talley/miniforge3/envs/superqt/lib/python3.11/site-packages/pytestqt/wait_signal.py", line 219, in _quit_loop_by_signal
    self._cleanup()
  File "/Users/talley/miniforge3/envs/superqt/lib/python3.11/site-packages/pytestqt/wait_signal.py", line 224, in _cleanup
    super()._cleanup()
  File "/Users/talley/miniforge3/envs/superqt/lib/python3.11/site-packages/pytestqt/wait_signal.py", line 66, in _cleanup
    _silent_disconnect(self._timer.timeout, self._quit_loop_by_timeout)
  File "/Users/talley/miniforge3/envs/superqt/lib/python3.11/site-packages/pytestqt/wait_signal.py", line 741, in _silent_disconnect
    signal.disconnect(slot)
SystemError: <method 'disconnect' of 'PySide6.QtCore.SignalInstance' objects> returned a result with an exception set
________________________________________________________________________________
=========================== short test summary info ============================
FAILED tests/test_thing.py::test_thing - Failed: CALL ERROR: Exceptions caught in Qt event loop:
============================== 1 failed in 0.17s ===============================

on Pyside 6.7.0, this worked but caused the RuntimeError warning as noted in #552.

tests/test_thing.py .                                                    [100%]

=============================== warnings summary ===============================
tests/test_thing.py::test_thing
  /Users/talley/miniforge3/envs/superqt/lib/python3.11/site-packages/pytestqt/wait_signal.py:741: RuntimeError: Failed to disconnect (<bound method _AbstractSignalBlocker._quit_loop_by_timeout of <pytestqt.wait_signal.SignalBlocker object at 0x108880d50>>) from signal "timeout()".
    signal.disconnect(slot)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================= 1 passed, 1 warning in 0.52s =========================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions