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:36:29 +02:00
parent 97eee1cfda
commit e431d3c9aa
8 changed files with 10 additions and 6 deletions

View file

@ -32,7 +32,7 @@ except ImportError:
"no sophisticated Python source file search will be done.", file=sys.stderr)
decl_re = re.compile(rb'^[ \t\f]*#.*coding[:=][ \t]*([-\w.]+)')
decl_re = re.compile(rb'^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)')
blank_re = re.compile(rb'^[ \t\f]*(?:[#\r\n]|$)')
def get_declaration(line):