-
-
Notifications
You must be signed in to change notification settings - Fork 244
Open
Description
In this code example, fun behaves different from decorated_fun. For more context, see https://stackoverflow.com/q/76596620/. I have tried a lot of things already to fix this. What works is the FunctionBuilder approach of boltons (basically some exec(compile(def fun(...)))). wrapt, however, is not able to fully emulate fun:
import wrapt
# pip install PySide6-Essentials
from PySide6.QtWidgets import QApplication, QSpinBox
def fun():
print("This works")
@wrapt.decorator
def my_decorator(wrapped, _instance, args, kwargs):
return wrapped(*args, **kwargs)
@my_decorator
def decorated_fun():
print("This fails")
app = QApplication()
box = QSpinBox()
box.valueChanged.connect(fun)
box.valueChanged.connect(decorated_fun)
box.setValue(10)Metadata
Metadata
Assignees
Labels
No labels