faulthandler: fix an EncodingWarning

This commit is contained in:
Ran Benita 2023-04-28 23:02:04 +03:00
parent a15f544962
commit 8288b52090
1 changed files with 1 additions and 1 deletions

View File

@ -27,7 +27,7 @@ def pytest_configure(config: Config) -> None:
import faulthandler import faulthandler
stderr_fd_copy = os.dup(get_stderr_fileno()) stderr_fd_copy = os.dup(get_stderr_fileno())
config.stash[fault_handler_stderr_key] = open(stderr_fd_copy, "w") config.stash[fault_handler_stderr_key] = open(stderr_fd_copy, "w", encoding=sys.stderr.encoding)
config.stash[fault_handler_originally_enabled_key] = faulthandler.is_enabled() config.stash[fault_handler_originally_enabled_key] = faulthandler.is_enabled()
faulthandler.enable(file=config.stash[fault_handler_stderr_key]) faulthandler.enable(file=config.stash[fault_handler_stderr_key])