summaryrefslogtreecommitdiffstats
path: root/Lib/tokenize.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-03-20 21:36:29 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-03-20 21:36:29 (GMT)
commite431d3c9aadb52dd1eea4d1e606e94f1c8471459 (patch)
tree5154063f2e6048881fa88675efd6dfb4bd2f5c4f /Lib/tokenize.py
parent97eee1cfda602df25866a6a62796f675caf52323 (diff)
downloadcpython-e431d3c9aadb52dd1eea4d1e606e94f1c8471459.zip
cpython-e431d3c9aadb52dd1eea4d1e606e94f1c8471459.tar.gz
cpython-e431d3c9aadb52dd1eea4d1e606e94f1c8471459.tar.bz2
Issue #26581: Use the first coding cookie on a line, not the last one.
Diffstat (limited to 'Lib/tokenize.py')
-rw-r--r--Lib/tokenize.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/tokenize.py b/Lib/tokenize.py
index 9fd676c..b1d0c83 100644
--- a/Lib/tokenize.py
+++ b/Lib/tokenize.py
@@ -33,7 +33,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