mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
#2834: Change re module semantics, so that str and bytes mixing is forbidden,
and str (unicode) patterns get full unicode matching by default. The re.ASCII flag is also introduced to ask for ASCII matching instead.
This commit is contained in:
parent
3ad7ba10a2
commit
fd036451bf
37 changed files with 280 additions and 163 deletions
|
@ -86,7 +86,7 @@ def read_encoding(file, default):
|
|||
line = f.readline()
|
||||
if not line:
|
||||
break
|
||||
m = re.match(r".*\bcoding:\s*(\S+)\b", line)
|
||||
m = re.match(br".*\bcoding:\s*(\S+)\b", line)
|
||||
if m:
|
||||
return m.group(1).decode("ascii")
|
||||
return default
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue