Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2358

bound method in value changed signal being substituted

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Not Evaluated Not Evaluated
    • None
    • 6.5.1
    • PySide
    • None

      Confirmed that this works fine in 6.5.0, but fails in 6.5.1.  My code looks like this:

      ```

      def bind_value_changing(top_level_dataclass: Any, all_parameters: Parameter) -> None:
          def value_changing(parameter: Any, value: Any, top_level_dataclass=top_level_dataclass) -> Any:
              print("Value changing", value_changing, parameter.name(), value, 

          def bind_signals(p: Parameter) -> None:
              for child in p.children():
                  print("Binding", child.name(), value_changing, type(top_level_dataclass))
                  child.sigValueChanged.connect(value_changing)
                  bind_signals(child)

      ```

      In this snippet, value_changing closes over top_level_dataclass.  Thus, there are multiple versions of value_changing, each called by a different signal. Only in 6.5.1, it appears that these have all been collapsed into a single function.

      Perhaps, there the signals are coalesced incorrectly?  It is incorrect to coalesce functions by name since they can close over values.  They can only be coalesced if they have the same id.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            crmaurei Cristian Maureira-Fredes
            neilgirdhar Neil Girdhar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes