summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-03-20 21:47:48 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-03-20 21:47:48 (GMT)
commita051bf3afbb30b7ddb7bd4c7ba03acc63288d6f2 (patch)
tree8d2fe8a1e6edbbae0ae6b0dd193a38d4033ef9fd /Lib/lib2to3
parentfc6990d3824340dd86f085250aac37267d57194f (diff)
parente431d3c9aadb52dd1eea4d1e606e94f1c8471459 (diff)
downloadcpython-a051bf3afbb30b7ddb7bd4c7ba03acc63288d6f2.zip
cpython-a051bf3afbb30b7ddb7bd4c7ba03acc63288d6f2.tar.gz
cpython-a051bf3afbb30b7ddb7bd4c7ba03acc63288d6f2.tar.bz2
Issue #26581: Use the first coding cookie on a line, not the last one.
Diffstat (limited to 'Lib/lib2to3')
-rw-r--r--Lib/lib2to3/pgen2/tokenize.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/lib2to3/pgen2/tokenize.py b/Lib/lib2to3/pgen2/tokenize.py
index 1ff1c61..d14db60 100644
--- a/Lib/lib2to3/pgen2/tokenize.py
+++ b/Lib/lib2to3/pgen2/tokenize.py
@@ -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):