[Bug #1633678] Improve pattern used for mbox 'From' lines; add a simple test
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index 63237bb..3e5d0b4 100755
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -1974,8 +1974,10 @@
# necessary. For convenience, we've added a PortableUnixMailbox class
# which does no checking of the format of the 'From' line.
- _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):