.. module:: mailcap
:synopsis: Mailcap file handling.
+ :deprecated:
**Source code:** :source:`Lib/mailcap.py`
+.. deprecated:: 3.11
+ The :mod:`mailcap` module is deprecated. See :pep:`594` for the rationale
+ and the :mod:`mimetypes` module for an alternative.
+
--------------
Mailcap files are used to configure how MIME-aware applications such as mail
email.rst
json.rst
- mailcap.rst
mailbox.rst
mimetypes.rst
base64.rst
crypt.rst
imghdr.rst
imp.rst
+ mailcap.rst
msilib.rst
- nntplib.rst
nis.rst
+ nntplib.rst
optparse.rst
ossaudiodev.rst
pipes.rst
* :mod:`chunk`
* :mod:`crypt`
* :mod:`imghdr`
+ * :mod:`mailcap`
* :mod:`msilib`
* :mod:`nis`
* :mod:`nntplib`
* :mod:`sunau`
* :mod:`telnetlib`
- (Contributed by Brett Cannon in :issue:`47061`.)
+ (Contributed by Brett Cannon in :issue:`47061` and Victor Stinner in
+ :gh:`68966`.)
Removed
__all__ = ["getcaps","findmatch"]
+_DEPRECATION_MSG = ('The {name} module is deprecated and will be removed in '
+ 'Python {remove}. See the mimetypes module for an '
+ 'alternative.')
+warnings._deprecated(__name__, _DEPRECATION_MSG, remove=(3, 13))
+
+
def lineno_sort_key(entry):
# Sort in ascending order, with unspecified entries at the end
if 'lineno' in entry:
-import mailcap
-import os
import copy
+import os
+import sys
import test.support
-from test.support import os_helper
import unittest
-import sys
+import warnings
+from test.support import os_helper
+from test.support import warnings_helper
+
+
+mailcap = warnings_helper.import_deprecated('mailcap')
+
# Location of mailcap file
MAILCAPFILE = test.support.findfile("mailcap.txt")
--- /dev/null
+The :mod:`mailcap` module is now deprecated and will be removed in Python 3.13.
+See :pep:`594` for the rationale and the :mod:`mimetypes` module for an
+alternative. Patch by Victor Stinner.