Python crashes when connecting a signal to method

I have a method (from a cythonized python module) that I can call from python without getting any errors. But when I try to connect it to a signal then python crashes:

Process finished with exit code -1073741819 (0xC0000005)

I’m really puzzled on what causes this.

Calling the function indirectly via a lambda works fine:

button = QtWidgets.QPushButton()

def test(*args):
    external.add_report()

button.clicked.connect(test)  # works
button.pbAddReport.clicked.connect(lambda *args: external.add_report(*args)) # works

but this fails:

button.clicked.connect(external.add_report)  # Fails with Process finished with exit code -1073741819 (0xC0000005)

any ideas???

Some testing shows that it happens for python 3.10 and 3.11 but not for 3.9

What’s the error message? Screen shot from the term or cmd?

The error message (from console) is:

this means that something which is not python code is doing something wrong. Either the Qt library or the compiled python code.
Either way pretty hard to debug.

In the means time I worked around this issue by upgrading to PySide6 where the problem does not occur.

I did some attempts to re-produce the error with another cythonized python module, there everything works fine. So I guess this is a very specific case: The cythonized function that I want to connect to is inside a class. The class is compiled with cython but it derives from a python class, which is term derives from a QDockWidget.

If you want to dive into it further then I’m willing to help, but for me the problem is gone. Wanted to port to qt6 anyways

I had a similar problem. Just swapped out a version of Cython for another version. The problem went away.