summaryrefslogtreecommitdiff
path: root/Lib/idlelib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-03-20 23:36:29 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2016-03-20 23:36:29 +0200
commite431d3c9aadb52dd1eea4d1e606e94f1c8471459 (patch)
tree5154063f2e6048881fa88675efd6dfb4bd2f5c4f /Lib/idlelib
parent97eee1cfda602df25866a6a62796f675caf52323 (diff)
downloadcpython-git-e431d3c9aadb52dd1eea4d1e606e94f1c8471459.tar.gz
Issue #26581: Use the first coding cookie on a line, not the last one.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r--Lib/idlelib/IOBinding.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py
index a4cc205c30..84f39a2fee 100644
--- a/Lib/idlelib/IOBinding.py
+++ b/Lib/idlelib/IOBinding.py
@@ -62,7 +62,7 @@ locale_encoding = locale_encoding.lower()
encoding = locale_encoding ### KBK 07Sep07 This is used all over IDLE, check!
### 'encoding' is used below in encode(), check!
-coding_re = re.compile(r'^[ \t\f]*#.*coding[:=][ \t]*([-\w.]+)', re.ASCII)
+coding_re = re.compile(r'^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)', re.ASCII)
blank_re = re.compile(r'^[ \t\f]*(?:[#\r\n]|$)', re.ASCII)
def coding_spec(data):