Fixed two typos in py_ext : FBID was not current but previous py_eval block FBID, and compiled AST cache was filled buy never used.
authorEdouard Tisserant
Thu, 26 Sep 2013 20:47:36 +0900
changeset 1288 adc79fc44079
parent 1287 70dc98533ec6
child 1329 9d0cb01312f0
Fixed two typos in py_ext : FBID was not current but previous py_eval block FBID, and compiled AST cache was filled buy never used.
py_ext/plc_python.c
runtime/PLCObject.py
--- a/py_ext/plc_python.c	Wed Aug 28 11:43:51 2013 +0200
+++ b/py_ext/plc_python.c	Thu Sep 26 20:47:36 2013 +0900
@@ -163,7 +163,6 @@
 	LockPython();
 	/* Get current FB */
 	data__ = EvalFBs[Current_Python_EvalFB];
-	*id=data__;
 	if(data__ && /* may be null at first run */
 	    __GET_VAR(data__->STATE) == PYTHON_FB_PROCESSING){ /* some answer awaited*/
 	   	/* If result not None */
@@ -209,6 +208,7 @@
 	__SET_VAR(data__->, BUFFER, 0, .body[__GET_VAR(data__->BUFFER, .len)]);
 	/* next command is BUFFER */
 	next_command = (char*)__GET_VAR(data__->BUFFER, .body);
+	*id=data__;
 	/* free python mutex */
 	UnLockPython();
 	/* return the next command to eval */
--- a/runtime/PLCObject.py	Wed Aug 28 11:43:51 2013 +0200
+++ b/runtime/PLCObject.py	Thu Sep 26 20:47:36 2013 +0900
@@ -329,7 +329,7 @@
                 if ccmd is None or ccmd!=cmd:
                     AST = compile(cmd, '<plc>', 'eval')
                     compile_cache[FBID]=(cmd,AST)
-                result,exp = self.evaluator(eval,cmd,self.python_runtime_vars)
+                result,exp = self.evaluator(eval,AST,self.python_runtime_vars)
                 if exp is not None: 
                     res = "#EXCEPTION : "+str(exp[1])
                     self.LogMessage(1,('PyEval@0x%x(Code="%s") Exception "%s"')%(FBID,cmd,