John Machin <sjmac...@users.sourceforge.net> added the comment: TWO POINTS: (1) I am not very concerned about chars like \x9d which are not valid in the declared encoding; I am more concerned with chars like \x93 and \x94 which *ARE* valid in the declared encoding. Please ensure that these cases are included in tests. (2) Please check your test data and test results. I get different results. I have created a file x9d.py by making the minimal changes to x94.py. For me, this blows up on bytecompiling with *both* 3.0 (UnicodeDecodeError, as expected) and 2.x (Syntax Error unknown encoding cp1252, wrong message) -- see below.
byte-compiling C:\python30\Lib\site-packages\x9d.py to x9d.pyc Traceback (most recent call last): File "setup.py", line 5, in <module> py_modules = ["foo3", "bar3", "x93", "x94", "x9d", "xa0b7"] File "C:\python30\lib\distutils\core.py", line 149, in setup dist.run_commands() File "C:\python30\lib\distutils\dist.py", line 942, in run_commands self.run_command(cmd) File "C:\python30\lib\distutils\dist.py", line 962, in run_command cmd_obj.run() File "C:\python30\lib\distutils\command\install.py", line 571, in run self.run_command(cmd_name) File "C:\python30\lib\distutils\cmd.py", line 317, in run_command self.distribution.run_command(command) File "C:\python30\lib\distutils\dist.py", line 962, in run_command cmd_obj.run() File "C:\python30\lib\distutils\command\install_lib.py", line 91, in run self.byte_compile(outfiles) File "C:\python30\lib\distutils\command\install_lib.py", line 125, in byte_compile dry_run=self.dry_run) File "C:\python30\lib\distutils\util.py", line 520, in byte_compile compile(file, cfile, dfile) File "C:\python30\lib\py_compile.py", line 137, in compile codestring = f.read() File "C:\python30\lib\io.py", line 1724, in read decoder.decode(self.buffer.read(), final=True)) File "C:\python30\lib\io.py", line 1295, in decode output = self.decoder.decode(input, final=final) File "C:\python30\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 64: character maps to <undefined> byte-compiling C:\python26\Lib\site-packages\x9d.py to x9d.pyc SyntaxError: ('unknown encoding: cp1252', ('C:\\python26\\Lib\\site-packages\\x9d.py', 0, 0, None)) byte-compiling c:\python25\Lib\site-packages\x9d.py to x9d.pyc File "c:\python25\Lib\site-packages\x9d.py", line 0 SyntaxError: ('unknown encoding: cp1252', ('c:\\python25\\Lib\\site-packages\\x9d.py', 0, 0, None)) Added file: http://bugs.python.org/file12492/x9d.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4742> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com