[GRASS-SVN] r73340 - grass/trunk/lib/python/ctypes/ctypesgencore/parser

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Sep 15 20:19:01 PDT 2018


Author: annakrat
Date: 2018-09-15 20:19:01 -0700 (Sat, 15 Sep 2018)
New Revision: 73340

Modified:
   grass/trunk/lib/python/ctypes/ctypesgencore/parser/lex.py
   grass/trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py
Log:
ctypes: fix compilation on Mac, not sure why it was there, we might need to revisit this if it causes problems

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/parser/lex.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/parser/lex.py	2018-09-16 03:16:58 UTC (rev 73339)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/parser/lex.py	2018-09-16 03:19:01 UTC (rev 73340)
@@ -44,7 +44,6 @@
 import types
 import collections
 import functools
-from grass.script.utils import decode
 
 if PY3:
     _meth_func = "__func__"
@@ -256,10 +255,7 @@
     # input() - Push a new string into the lexer
     # ------------------------------------------------------------
     def input(self, s):
-        s = decode(s)
-        if not (isinstance(s, bytes) or
-                isinstance(s, str) or
-                isinstance(s, unicode)):
+        if not (isinstance(s, bytes) or isinstance(s, str)):
             raise ValueError("Expected a string")
         self.lexdata = s
         self.lexpos = 0

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py	2018-09-16 03:16:58 UTC (rev 73339)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py	2018-09-16 03:19:01 UTC (rev 73340)
@@ -21,7 +21,6 @@
 from . import lex
 from . import yacc
 from .lex import TOKEN
-from grass.script.utils import encode, decode
 
 
 PY2 = True
@@ -77,7 +76,6 @@
 class StringLiteral(str):
 
     def __new__(cls, value):
-        value = decode(value)
         # Unescaping probably not perfect but close enough.
         try:
             value = re.sub(r'\\x([0-9a-fA-F])(?![0-9a-fA-F])',
@@ -283,7 +281,7 @@
 @TOKEN(STRING_LITERAL)
 def t_ANY_string_literal(t):
     t.type = 'STRING_LITERAL'
-    t.value = StringLiteral(encode(t.value))
+    t.value = StringLiteral(t.value)
     return t
 
 



More information about the grass-commit mailing list