Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(15536)

Unified Diff: Tools/scripts/findnocoding.py

Issue 18873: "Encoding" detected in non-comment lines
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/tokenize.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Tools/scripts/findnocoding.py Thu Sep 05 18:02:31 2013 +0300
+++ b/Tools/scripts/findnocoding.py Sat Sep 07 17:49:25 2013 +0300
@@ -32,13 +32,13 @@
"no sophisticated Python source file search will be done.", file=sys.stderr)
-decl_re = re.compile(rb"coding[=:]\s*([-\w.]+)")
+decl_re = re.compile(rb'^[ \t\f]*#.*coding[:=][ \t]*([-\w.]+)')
def get_declaration(line):
- match = decl_re.search(line)
+ match = decl_re.match(line)
if match:
return match.group(1)
- return ''
+ return b''
def has_correct_encoding(text, codec):
try:
« no previous file with comments | « Lib/tokenize.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+