mirror of
https://github.com/Z3Prover/z3
synced 2025-06-10 08:03:25 +00:00
parent
4e8ba8b160
commit
0eb04df834
1 changed files with 25 additions and 17 deletions
|
@ -1819,25 +1819,33 @@ if _lib is None:
|
|||
print(" builtins.Z3_LIB_DIRS = [ '/path/to/libz3.%s' ] " % _ext)
|
||||
raise Z3Exception("libz3.%s not found." % _ext)
|
||||
|
||||
def _str_to_bytes(s):
|
||||
if isinstance(s, str):
|
||||
try:
|
||||
return s.encode('latin-1')
|
||||
except:
|
||||
# kick the bucket down the road. :-J
|
||||
return s
|
||||
else:
|
||||
return s
|
||||
# def _str_to_bytes(s):
|
||||
# if isinstance(s, str):
|
||||
# try:
|
||||
# return s.encode('latin-1')
|
||||
# except:
|
||||
# # kick the bucket down the road. :-J
|
||||
# return s
|
||||
# else:
|
||||
# return s
|
||||
|
||||
if sys.version < '3':
|
||||
def _str_to_bytes(s):
|
||||
return s
|
||||
def _to_pystr(s):
|
||||
return s
|
||||
else:
|
||||
def _str_to_bytes(s):
|
||||
if isinstance(s, str):
|
||||
enc = sys.stdout.encoding
|
||||
return s.encode(enc if enc != None else 'latin-1')
|
||||
else:
|
||||
return s
|
||||
|
||||
def _to_pystr(s):
|
||||
if s != None:
|
||||
enc = sys.stdout.encoding
|
||||
if enc != None: return s.decode(enc)
|
||||
else: return s.decode('latin-1')
|
||||
return s.decode(enc if enc != None else 'latin-1')
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue