diff options
author | Christian Heimes <christian@cheimes.de> | 2007-11-08 16:34:32 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2007-11-08 16:34:32 (GMT) |
commit | 8bd14fb398b1b89c82defdac6c5755c9ca86859b (patch) | |
tree | 6b0c944665e76f33d32bd40c7676693c7556a2a6 /Lib/io.py | |
parent | 1a13d597093422d666e0efa3d6d51f8a507b5317 (diff) | |
download | cpython-8bd14fb398b1b89c82defdac6c5755c9ca86859b.zip cpython-8bd14fb398b1b89c82defdac6c5755c9ca86859b.tar.gz cpython-8bd14fb398b1b89c82defdac6c5755c9ca86859b.tar.bz2 |
Fixed #1403 where compileall and py_compile choked on an encoding header in a py file. Both modules need more unit tests.
Diffstat (limited to 'Lib/io.py')
-rw-r--r-- | Lib/io.py | 3 |
1 files changed, 3 insertions, 0 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 |