New submission from Pierre Carbonnelle :
The following code
print("outside:", sys.stdout.encoding)
with redirect_stdout(io.StringIO()) as f:
print("inside: ", sys.stdout.encoding)
print(f.getvalue())
yields:
outside: utf-8
inside: None
B
Pierre Carbonnelle added the comment:
I expect sys.stdout to have utf-8 encoding inside the redirect because the
buffer accepts unicode code points (not bytes), just as it does outside of the
redirect. In other words, I expect the 'encoding' attribute of sys.stdout to
have the
Pierre Carbonnelle added the comment:
As a work around, I had to use a temporary file (instead of a memory buffer):
print("outside:", sys.stdout.encoding)
with open("/tmp/log.txt", mode='w', encoding='utf-8') as buf:
with redirect_std
Pierre Carbonnelle added the comment:
I can live with the workaround, so, you can close the issue if you wish. As
you say, maybe it's an issue with z3.
Thank you for your time.
--
___
Python tracker
<https://bugs.python.org/is