[issue4021] tokenize.detect_encoding(): raise SyntaxError on codecs.lookup() error

Amaury Forgeot d'Arc report at bugs.python.org
Fri Oct 3 01:49:04 CEST 2008


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

This patch seems good to me, it fixes the following test:

Index: Lib/test/test_tokenize.py
===================================================================
--- Lib/test/test_tokenize.py	(revision 66701)
+++ Lib/test/test_tokenize.py	(working copy)
@@ -795,6 +795,8 @@
         self.assertEquals(encoding, 'utf-8')
         self.assertEquals(consumed_lines, [])
 
+        readline = self.get_readline((b'# coding: bad\n',))
+        self.assertRaises(SyntaxError, detect_encoding, readline)
 
 class TestTokenize(TestCase):

----------
keywords: +needs review
nosy: +amaury.forgeotdarc

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4021>
_______________________________________


More information about the Python-bugs-list mailing list