File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -453,12 +453,34 @@ file:2: error: Unknown encoding 'uft-8'
453
453
[out]
454
454
file:1: error: Unknown encoding 'Uft.8'
455
455
456
- [case testInvalidEncoding2 ]
456
+ [case testInvalidEncoding3 ]
457
457
#!/usr/bin python
458
458
# vim: set fileencoding=uft8 :
459
459
[out]
460
460
file:2: error: Unknown encoding 'uft8'
461
461
462
+ [case testDoubleEncoding]
463
+ # coding: uft8
464
+ # coding: utf8
465
+ # The first coding cookie should be used and fail.
466
+ [out]
467
+ file:1: error: Unknown encoding 'uft8'
468
+
469
+ [case testDoubleEncoding2]
470
+ # Again the first cookie should be used and fail.
471
+ # coding: uft8
472
+ # coding: utf8
473
+ [out]
474
+ file:2: error: Unknown encoding 'uft8'
475
+
476
+ [case testDoubleEncoding3]
477
+ # If the third line were interpreted as a coding cookie, we'd get a
478
+ # different error message.
479
+ # coding: ascii
480
+ á = 1
481
+ [out]
482
+ file:4: error: Unrecognized character
483
+
462
484
[case testLongLiteralInPython3]
463
485
2L
464
486
0x2L
Original file line number Diff line number Diff line change 7
7
8
8
T = TypeVar ('T' )
9
9
10
- ENCODING_RE = re .compile (br'(\s*#.*(\r\n?|\n))?\s*#.*coding[:=]\s*([-\w.]+)' )
10
+ ENCODING_RE = re .compile (br'(\s*#.*(\r\n?|\n)){0,1} ?\s*#.*coding[:=]\s*([-\w.]+)' )
11
11
12
12
default_python2_interpreter = ['python2' , 'python' , '/usr/bin/python' ]
13
13
You can’t perform that action at this time.
0 commit comments