[output] set 'errors=replace' for output streams (#3765)

fixes regression from e480a933
This commit is contained in:
Mike Fährmann
2023-03-13 12:04:24 +01:00
parent a14a2d6e59
commit f7ce33c85c
2 changed files with 6 additions and 7 deletions

View File

@@ -270,16 +270,15 @@ else:
def configure_standard_streams():
for name in ("stdout", "stderr", "stdin"):
options = config.get(("output",), name)
if not options:
continue
stream = getattr(sys, name, None)
if not stream:
continue
if isinstance(options, str):
options = {"encoding": options, "errors": "replace"}
options = config.get(("output",), name)
if not options:
options = {"errors": "replace"}
elif isinstance(options, str):
options = {"errors": "replace", "encoding": options}
elif not options.get("errors"):
options["errors"] = "replace"

View File

@@ -6,4 +6,4 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
__version__ = "1.25.0"
__version__ = "1.25.1-dev"