mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Fixed #1403 where compileall and py_compile choked on an encoding header in a py file. Both modules need more unit tests.
This commit is contained in:
parent
1a13d59709
commit
8bd14fb398
2 changed files with 4 additions and 1 deletions
|
@ -1063,6 +1063,9 @@ class TextIOWrapper(TextIOBase):
|
|||
else:
|
||||
encoding = locale.getpreferredencoding()
|
||||
|
||||
if not isinstance(encoding, str):
|
||||
raise ValueError("invalid encoding: %r" % encoding)
|
||||
|
||||
self.buffer = buffer
|
||||
self._encoding = encoding
|
||||
self._readuniversal = not newline
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue