mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #26581: Use the first coding cookie on a line, not the last one.
This commit is contained in:
parent
97eee1cfda
commit
e431d3c9aa
8 changed files with 10 additions and 6 deletions
|
@ -236,7 +236,7 @@ class Untokenizer:
|
|||
startline = False
|
||||
toks_append(tokval)
|
||||
|
||||
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)
|
||||
|
||||
def _get_normal_name(orig_enc):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue