From 26305a03e3d501f9338af3f1373f8ec7da88838f Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 12 Jun 2008 22:33:06 +0000 Subject: [PATCH] add py3k warnings to rfc822 --- Doc/library/rfc822.rst | 3 ++- Lib/rfc822.py | 3 +++ Lib/test/test_py3kwarn.py | 2 +- Lib/test/test_rfc822.py | 3 ++- Misc/NEWS | 2 ++ 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Doc/library/rfc822.rst b/Doc/library/rfc822.rst index 37fef78f1ce..4c938f5138d 100644 --- a/Doc/library/rfc822.rst +++ b/Doc/library/rfc822.rst @@ -9,7 +9,8 @@ .. deprecated:: 2.3 The :mod:`email` package should be used in preference to the :mod:`rfc822` - module. This module is present only to maintain backward compatibility. + module. This module is present only to maintain backward compatibility, and + has been removed in 3.0. This module defines a class, :class:`Message`, which represents an "email message" as defined by the Internet standard :rfc:`2822`. [#]_ Such messages diff --git a/Lib/rfc822.py b/Lib/rfc822.py index 14cc7297f1d..4382a51b70d 100644 --- a/Lib/rfc822.py +++ b/Lib/rfc822.py @@ -73,6 +73,9 @@ There are also some utility functions here. import time +from warnings import warnpy3k +warnpy3k("in 3.x, rfc822 has been removed in favor of the email package") + __all__ = ["Message","AddressList","parsedate","parsedate_tz","mktime_tz"] _blanklines = ('\r\n', '\n') # Optimization for islast() diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py index b2dc8cd9b35..a289cc765db 100644 --- a/Lib/test/test_py3kwarn.py +++ b/Lib/test/test_py3kwarn.py @@ -198,7 +198,7 @@ class TestStdlibRemovals(unittest.TestCase): # import side-effect. all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new', 'rexec', 'Bastion', 'compiler', 'dircache', 'mimetools', 'fpformat', - 'ihooks', 'mhlib', 'statvfs', 'htmllib', 'sgmllib') + 'ihooks', 'mhlib', 'statvfs', 'htmllib', 'sgmllib', 'rfc822') inclusive_platforms = {'irix' : ('pure', 'AL', 'al', 'CD', 'cd', 'cddb', 'cdplayer', 'CL', 'cl', 'DEVICE', 'GL', 'gl', 'ERRNO', 'FILE', 'FL', 'flp', 'fl', diff --git a/Lib/test/test_rfc822.py b/Lib/test/test_rfc822.py index 197887d4aa9..afbc984c87a 100644 --- a/Lib/test/test_rfc822.py +++ b/Lib/test/test_rfc822.py @@ -1,7 +1,8 @@ -import rfc822 import unittest from test import test_support +rfc822 = test_support.import_module("rfc822", deprecated=True) + try: from cStringIO import StringIO except ImportError: diff --git a/Misc/NEWS b/Misc/NEWS index 5bd09deea60..2481de34085 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -84,6 +84,8 @@ Extension Modules Library ------- +- The rfc822 module has been deprecated for removal in 3.0. + - The mimetools module has been deprecated for removal in 3.0. - The ctypes.byref function now takes an optional second parameter