diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-09-16 21:00:46 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-09-16 21:00:46 (GMT) |
commit | e787bce79c016cf7b9e743a6230ceb8e97b4a938 (patch) | |
tree | 2b86121e69e169391770e3adace1e55c28805fc8 /Tools | |
parent | 74213e4ee941e163ebdfa6b7d3d493ee68f6bb8d (diff) | |
download | cpython-e787bce79c016cf7b9e743a6230ceb8e97b4a938.zip cpython-e787bce79c016cf7b9e743a6230ceb8e97b4a938.tar.gz cpython-e787bce79c016cf7b9e743a6230ceb8e97b4a938.tar.bz2 |
Issue #18873: IDLE, 2to3, and the findnocoding.py script now detect Python
source code encoding only in comment lines.
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/findnocoding.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Tools/scripts/findnocoding.py b/Tools/scripts/findnocoding.py index e49fc42..838e573 100755 --- a/Tools/scripts/findnocoding.py +++ b/Tools/scripts/findnocoding.py @@ -32,13 +32,13 @@ except ImportError: "no sophisticated Python source file search will be done.") -decl_re = re.compile(r"coding[=:]\s*([-\w.]+)") +decl_re = re.compile(r'^[ \t\f]*#.*coding[:=][ \t]*([-\w.]+)', re.ASCII) 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: |