From e431d3c9aadb52dd1eea4d1e606e94f1c8471459 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 20 Mar 2016 23:36:29 +0200 Subject: Issue #26581: Use the first coding cookie on a line, not the last one. --- Lib/tokenize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/tokenize.py') diff --git a/Lib/tokenize.py b/Lib/tokenize.py index 9fd676c5b2..b1d0c83263 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 -- cgit v1.2.1