File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -745,6 +745,10 @@ def test_utf8_coding_cookie_and_utf8_bom(self):
745745 f = 'tokenize_tests-utf8-coding-cookie-and-utf8-bom-sig.txt'
746746 self .assertTrue (self ._testFile (f ))
747747
748+ def test_bad_coding_cookie (self ):
749+ self .assertRaises (SyntaxError , self ._testFile , 'bad_coding.py' )
750+ self .assertRaises (SyntaxError , self ._testFile , 'bad_coding2.py' )
751+
748752
749753class Test_Tokenize (TestCase ):
750754
Original file line number Diff line number Diff line change @@ -388,7 +388,7 @@ def find_cookie(line):
388388 raise SyntaxError (msg )
389389
390390 if bom_found :
391- if codec . name != 'utf-8' :
391+ if encoding != 'utf-8' :
392392 # This behaviour mimics the Python interpreter
393393 if filename is None :
394394 msg = 'encoding problem: utf-8'
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ Core and Builtins
2323Library
2424-------
2525
26+ - Issue #14990: Correctly fail with SyntaxError on invalid encoding
27+ declaration.
28+
2629- Issue #14814: ipaddress now provides more informative error messages when
2730 constructing instances directly (changes permitted during beta due to
2831 provisional API status)
You can’t perform that action at this time.
0 commit comments