Fixed bug when generating py_ext code when no variable defined
authorLaurent Bessard
Wed, 15 May 2013 23:11:49 +0200
changeset 1148 d0e40e99f422
parent 1147 71db4592beb2
child 1149 67df52302ea6
Fixed bug when generating py_ext code when no variable defined
py_ext/PythonFileCTNMixin.py
--- a/py_ext/PythonFileCTNMixin.py	Wed May 15 22:37:07 2013 +0200
+++ b/py_ext/PythonFileCTNMixin.py	Wed May 15 23:11:49 2013 +0200
@@ -157,7 +157,7 @@
     }
 """ 
 
-        vardec, varret, varpub = map("\n".join, zip(*[
+        var_str = map("\n".join, zip(*[
             map(lambda f : f % varinfo,
                 (vardecfmt, varretfmt, varpubfmt))
                 for varinfo in map(lambda variable : {
@@ -167,6 +167,10 @@
                     "IECtype": "IEC_%s"%variable.gettype(),
                     "initial" : str(variable.getinitial())},
                     self.CodeFile.variables.variable)]))
+        if len(var_str) > 0:
+            vardec, varret, varpub = var_str
+        else:
+            vardec = varret = varpub = ""
         
         PyCFileContent = """\
 /*