Issue #26581: Use the first coding cookie on a line, not the last one.

This commit is contained in:
Serhiy Storchaka 2016-03-20 23:47:48 +02:00
commit a051bf3afb
8 changed files with 10 additions and 6 deletions

View file

@ -34,7 +34,7 @@ import re
import sys
from token import *
cookie_re = re.compile(r'^[ \t\f]*#.*coding[:=][ \t]*([-\w.]+)', re.ASCII)
cookie_re = re.compile(r'^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)', re.ASCII)
blank_re = re.compile(br'^[ \t\f]*(?:[#\r\n]|$)', re.ASCII)
import token