diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-01-04 23:22:44 +0000 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-01-04 23:22:44 +0000 |
commit | b9d4963a989accce30234b7b74bce874c0142209 (patch) | |
tree | 63fa25095a756b9def7c84cf7eb88d68c2412e29 /Lib/mailbox.py | |
parent | b9c3ed4f82d3551c9906da55ddb8059ac3b5ce94 (diff) | |
download | cpython-git-b9d4963a989accce30234b7b74bce874c0142209.tar.gz |
Issue #7092: Fix the DeprecationWarnings emitted by the standard library
when using the -3 flag. Patch by Florent Xicluna.
Diffstat (limited to 'Lib/mailbox.py')
-rwxr-xr-x | Lib/mailbox.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py index 74359b7aa6..4da556935e 100755 --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -18,7 +18,6 @@ import copy import email import email.message import email.generator -import rfc822 import StringIO try: if sys.platform == 'os2emx': @@ -28,6 +27,13 @@ try: except ImportError: fcntl = None +import warnings +with warnings.catch_warnings(): + if sys.py3kwarning: + warnings.filterwarnings("ignore", ".*rfc822 has been removed", + DeprecationWarning) + import rfc822 + __all__ = [ 'Mailbox', 'Maildir', 'mbox', 'MH', 'Babyl', 'MMDF', 'Message', 'MaildirMessage', 'mboxMessage', 'MHMessage', 'BabylMessage', 'MMDFMessage', 'UnixMailbox', |