diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2008-08-19 17:56:33 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2008-08-19 17:56:33 (GMT) |
commit | fd036451bf0e0ade8783e21df801abf7be96d020 (patch) | |
tree | e70ff65a9e641d8e790bc091f0dc2507baf344ca /Lib/imaplib.py | |
parent | 3ad7ba10a20827b24d4b1aa9dd49474db8affbdd (diff) | |
download | cpython-fd036451bf0e0ade8783e21df801abf7be96d020.zip cpython-fd036451bf0e0ade8783e21df801abf7be96d020.tar.gz cpython-fd036451bf0e0ade8783e21df801abf7be96d020.tar.bz2 |
#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.
Diffstat (limited to 'Lib/imaplib.py')
-rw-r--r-- | Lib/imaplib.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/imaplib.py b/Lib/imaplib.py index 0d9704e..156b15d 100644 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -88,11 +88,12 @@ InternalDate = re.compile(r'.*INTERNALDATE "' r' (?P<hour>[0-9][0-9]):(?P<min>[0-9][0-9]):(?P<sec>[0-9][0-9])' r' (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])' r'"') -Literal = re.compile(r'.*{(?P<size>\d+)}$') +Literal = re.compile(r'.*{(?P<size>\d+)}$', re.ASCII) MapCRLF = re.compile(r'\r\n|\r|\n') Response_code = re.compile(r'\[(?P<type>[A-Z-]+)( (?P<data>[^\]]*))?\]') Untagged_response = re.compile(r'\* (?P<type>[A-Z-]+)( (?P<data>.*))?') -Untagged_status = re.compile(r'\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?') +Untagged_status = re.compile( + r'\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?', re.ASCII) @@ -146,7 +147,7 @@ class IMAP4: class abort(error): pass # Service errors - close and retry class readonly(abort): pass # Mailbox status changed to READ-ONLY - mustquote = re.compile(r"[^\w!#$%&'*+,.:;<=>?^`|~-]") + mustquote = re.compile(r"[^\w!#$%&'*+,.:;<=>?^`|~-]", re.ASCII) def __init__(self, host = '', port = IMAP4_PORT): self.debug = Debug @@ -168,7 +169,7 @@ class IMAP4: self.tagpre = Int2AP(random.randint(4096, 65535)) self.tagre = re.compile(r'(?P<tag>' + self.tagpre - + r'\d+) (?P<type>[A-Z]+) (?P<data>.*)') + + r'\d+) (?P<type>[A-Z]+) (?P<data>.*)', re.ASCII) # Get server welcome message, # request and store CAPABILITY response. |