3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-04 16:44:07 +00:00

Use sys.getdefaultencoding() instead of sys.stdout.encoding (#6612)

This commit is contained in:
Kevin Phoenix 2023-02-28 12:46:10 -07:00 committed by GitHub
parent 6e7d80633d
commit 1a9990a92f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View file

@ -37,7 +37,7 @@ def help(ous):
out = subprocess.Popen([z3_exe, "-pm"],stdout=subprocess.PIPE).communicate()[0]
modules = ["global"]
if out != None:
out = out.decode(sys.stdout.encoding)
out = out.decode(sys.getdefaultencoding())
module_re = re.compile(r"\[module\] (.*)\,")
lines = out.split("\n")
for line in lines:
@ -48,7 +48,7 @@ def help(ous):
out = subprocess.Popen([z3_exe, "-pmmd:%s" % module],stdout=subprocess.PIPE).communicate()[0]
if out == None:
continue
out = out.decode(sys.stdout.encoding)
out = out.decode(sys.getdefaultencoding())
out = out.replace("\r","")
ous.write(out)

View file

@ -28,7 +28,7 @@ def extract_params(ous, tac):
out = subprocess.Popen([z3_exe, f"-tacticsmd:{tac}"], stdout=subprocess.PIPE).communicate()[0]
if not out:
return
out = out.decode(sys.stdout.encoding)
out = out.decode(sys.getdefaultencoding())
if is_ws(out):
return
ous.write("### Parameters\n\n")

View file

@ -122,7 +122,7 @@ FPMATH_ENABLED=getenv("FPMATH_ENABLED", "True")
def check_output(cmd):
out = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
if out != None:
enc = sys.stdout.encoding
enc = sys.getdefaultencoding()
if enc != None: return out.decode(enc).rstrip('\r\n')
else: return out.rstrip('\r\n')
else:

View file

@ -1836,14 +1836,14 @@ if sys.version < '3':
else:
def _str_to_bytes(s):
if isinstance(s, str):
enc = sys.stdout.encoding
enc = sys.getdefaultencoding()
return s.encode(enc if enc != None else 'latin-1')
else:
return s
def _to_pystr(s):
if s != None:
enc = sys.stdout.encoding
enc = sys.getdefaultencoding()
return s.decode(enc if enc != None else 'latin-1')
else:
return ""