summaryrefslogtreecommitdiffstats
path: root/Tools/scripts
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 /Tools/scripts
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 'Tools/scripts')
-rwxr-xr-xTools/scripts/findnocoding.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Tools/scripts/findnocoding.py b/Tools/scripts/findnocoding.py
index 5f3795e..6c16b1c 100755
--- a/Tools/scripts/findnocoding.py
+++ b/Tools/scripts/findnocoding.py
@@ -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):