Archived

This forum has been archived. Please start a new discussion on GitHub.

Patch for Slice2py for self property

Using 'self' as the name of a property within a Slice struct seems valid, but generates runtime errors when used in Python.

The following simple patch adds 'self' as a keyword in the slice2py compiler:
--- cpp/src/Slice/PythonUtil.cpp	2011-06-15 21:43:59.000000000 +0200
+++ PythonUtil.cpp	2013-01-23 13:26:04.241021454 +0100
@@ -185,7 +185,7 @@
     {
         "None", "and", "assert", "break", "class", "continue", "def", "del", "elif", "else", "except", "exec",
         "finally", "for", "from", "global", "if", "import", "in", "is", "lambda", "not", "or", "pass",
-        "print", "raise", "return", "try", "while", "yield"
+        "print", "raise", "return", "self", "try", "while", "yield"
     };
     bool found =  binary_search(&keywordList[0],
                                 &keywordList[sizeof(keywordList) / sizeof(*keywordList)],

Comments