Skip to content

Commit 478f72e

Browse files
author
brett.cannon
committed
Have MimeWriter raise a DeprecationWarning as per PEP 4 and its documentation.
git-svn-id: http://svn.python.org/projects/python/trunk@55686 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 7a36886 commit 478f72e

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

Lib/MimeWriter.py

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414

1515
__all__ = ["MimeWriter"]
1616

17+
import warnings
18+
19+
warnings.warn("the MimeWriter module is deprecated; use the email package instead",
20+
DeprecationWarning, 2)
21+
1722
class MimeWriter:
1823

1924
"""Generic MIME writer.

Lib/test/test_MimeWriter.py

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
import unittest, sys, StringIO
1111
from test.test_support import run_unittest
1212

13+
import warnings
14+
warnings.filterwarnings("ignore", "the MimeWriter module is deprecated.*",
15+
DeprecationWarning)
16+
1317
from MimeWriter import MimeWriter
1418

1519
SELLER = '''\

Lib/test/test___all__.py

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
DeprecationWarning, "<string>")
88
warnings.filterwarnings("ignore", ".*popen2 module is deprecated.*",
99
DeprecationWarning)
10+
warnings.filterwarnings("ignore", "the MimeWriter module is deprecated.*",
11+
DeprecationWarning)
1012

1113
class AllTest(unittest.TestCase):
1214

Misc/NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ Core and builtins
220220
Library
221221
-------
222222

223+
- MimeWriter now raises a DeprecationWarning upon import.
224+
223225
- tarfile.py: Improved unicode support. Unicode input names are now
224226
officially supported. Added "errors" argument to the TarFile class.
225227

0 commit comments

Comments
 (0)