mirror of
https://github.com/python/cpython.git
synced 2025-08-27 04:05:34 +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
|
@ -590,7 +590,8 @@ def parse150(resp):
|
|||
global _150_re
|
||||
if _150_re is None:
|
||||
import re
|
||||
_150_re = re.compile("150 .* \((\d+) bytes\)", re.IGNORECASE)
|
||||
_150_re = re.compile(
|
||||
"150 .* \((\d+) bytes\)", re.IGNORECASE | re.ASCII)
|
||||
m = _150_re.match(resp)
|
||||
if not m:
|
||||
return None
|
||||
|
@ -613,7 +614,7 @@ def parse227(resp):
|
|||
global _227_re
|
||||
if _227_re is None:
|
||||
import re
|
||||
_227_re = re.compile(r'(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)')
|
||||
_227_re = re.compile(r'(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)', re.ASCII)
|
||||
m = _227_re.search(resp)
|
||||
if not m:
|
||||
raise error_proto(resp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue