Explorar o código

ctypes: fix compilation on Mac, not sure why it was there, we might need to revisit this if it causes problems

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@73340 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová %!s(int64=6) %!d(string=hai) anos
pai
achega
568d742a5a

+ 1 - 5
lib/python/ctypes/ctypesgencore/parser/lex.py

@@ -44,7 +44,6 @@ import sys
 import types
 import collections
 import functools
-from grass.script.utils import decode
 
 if PY3:
     _meth_func = "__func__"
@@ -256,10 +255,7 @@ class Lexer:
     # 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

+ 1 - 3
lib/python/ctypes/ctypesgencore/parser/pplexer.py

@@ -21,7 +21,6 @@ import ctypes
 from . import lex
 from . import yacc
 from .lex import TOKEN
-from grass.script.utils import encode, decode
 
 
 PY2 = True
@@ -77,7 +76,6 @@ def sub(s):
 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 @@ STRING_LITERAL = sub(r'L?"(\\.|[^\\"])*"')
 @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