summaryrefslogtreecommitdiffstats
path: root/Lib/mailbox.py
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2007-01-22 20:26:40 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2007-01-22 20:26:40 (GMT)
commitb78bb74c418767c2b5d046ccc85e0b106877a9f8 (patch)
tree49218f797e64249720b9848cb4b45744d7bc7533 /Lib/mailbox.py
parent5a096e1b100603f5537eca5124be17abacf17743 (diff)
downloadcpython-b78bb74c418767c2b5d046ccc85e0b106877a9f8.zip
cpython-b78bb74c418767c2b5d046ccc85e0b106877a9f8.tar.gz
cpython-b78bb74c418767c2b5d046ccc85e0b106877a9f8.tar.bz2
Improve pattern used for mbox 'From' lines; add a simple test
Diffstat (limited to 'Lib/mailbox.py')
-rwxr-xr-xLib/mailbox.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index f8d4df3..17e062e 100755
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -1995,8 +1995,10 @@ class UnixMailbox(_Mailbox):
# necessary. For convenience, we've added a PortableUnixMailbox class
# which uses the more lenient _fromlinepattern regular expression.
- _fromlinepattern = r"From \s*[^\s]+\s+\w\w\w\s+\w\w\w\s+\d?\d\s+" \
- r"\d?\d:\d\d(:\d\d)?(\s+[^\s]+)?\s+\d\d\d\d\s*$"
+ _fromlinepattern = (r"From \s*[^\s]+\s+\w\w\w\s+\w\w\w\s+\d?\d\s+"
+ r"\d?\d:\d\d(:\d\d)?(\s+[^\s]+)?\s+\d\d\d\d\s*"
+ r"[^\s]*\s*"
+ "$")
_regexp = None
def _strict_isrealfromline(self, line):