Issue #26581: Use the first coding cookie on a line, not the last one.
diff --git a/Tools/scripts/findnocoding.py b/Tools/scripts/findnocoding.py
index 70b1a66..79ea7e5 100755
--- a/Tools/scripts/findnocoding.py
+++ b/Tools/scripts/findnocoding.py
@@ -32,7 +32,7 @@
"no sophisticated Python source file search will be done.")
-decl_re = re.compile(r'^[ \t\f]*#.*coding[:=][ \t]*([-\w.]+)')
+decl_re = re.compile(r'^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)')
blank_re = re.compile(r'^[ \t\f]*(?:[#\r\n]|$)')
def get_declaration(line):