Fixed "Onchange" object added in previous commit
authorEdouard Tisserant
Thu, 10 Dec 2020 14:54:42 +0100
changeset 2698 e50d32c747b3
parent 2697 93333d206198
child 2699 467ff0e58327
Fixed "Onchange" object added in previous commit
runtime/PLCObject.py
--- a/runtime/PLCObject.py	Thu Dec 10 11:37:27 2020 +0100
+++ b/runtime/PLCObject.py	Thu Dec 10 14:54:42 2020 +0100
@@ -362,12 +362,11 @@
 
         class OnChangeStateClass(object):
             def __getattr__(self, name):
-                res = object()
                 u = parent.python_runtime_vars["_"+name+"_unpack"]
-                res.count = parent.python_runtime_vars["_PyOnChangeCount_"+name].value
-                res.first = u(parent.python_runtime_vars["_PyOnChangeFirst_"+name])
-                res.last = u(parent.python_runtime_vars["_PyOnChangeLast_"+name])
-                return res
+                return type("changedesc",(),dict(
+                    count = parent.python_runtime_vars["_PyOnChangeCount_"+name].value,
+                    first = u(parent.python_runtime_vars["_PyOnChangeFirst_"+name]),
+                    last = u(parent.python_runtime_vars["_PyOnChangeLast_"+name])))
 
 
         self.python_runtime_vars.update({