mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25189)
* Fix _sitebuiltins * Fix test_inspect * Fix test_interpreters * Fix test_io * Fix test_iter * Fix test_json * Fix test_linecache * Fix test_lltrace * Fix test_logging * Fix logging
This commit is contained in:
parent
f84d5a1136
commit
fb78692f2a
11 changed files with 73 additions and 63 deletions
|
@ -1150,6 +1150,8 @@ class FileHandler(StreamHandler):
|
|||
self.baseFilename = os.path.abspath(filename)
|
||||
self.mode = mode
|
||||
self.encoding = encoding
|
||||
if "b" not in mode:
|
||||
self.encoding = io.text_encoding(encoding)
|
||||
self.errors = errors
|
||||
self.delay = delay
|
||||
# bpo-26789: FileHandler keeps a reference to the builtin open()
|
||||
|
@ -2022,8 +2024,10 @@ def basicConfig(**kwargs):
|
|||
filename = kwargs.pop("filename", None)
|
||||
mode = kwargs.pop("filemode", 'a')
|
||||
if filename:
|
||||
if 'b'in mode:
|
||||
if 'b' in mode:
|
||||
errors = None
|
||||
else:
|
||||
encoding = io.text_encoding(encoding)
|
||||
h = FileHandler(filename, mode,
|
||||
encoding=encoding, errors=errors)
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue