mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #26581: Use the first coding cookie on a line, not the last one.
This commit is contained in:
commit
a051bf3afb
8 changed files with 10 additions and 6 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue