From: sobolevn Date: Tue, 8 Apr 2025 10:40:41 +0000 (+0300) Subject: [3.12] gh-101137: Add `text/x-rst` to `mimetypes` (GH-118593) (GH-118599) X-Git-Tag: v3.12.10~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b41e008edb4b5c54efedb029c96b16c66446a0d3;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-101137: Add `text/x-rst` to `mimetypes` (GH-118593) (GH-118599) --- diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py index 64b550b06901..814b3f9c9f9e 100644 --- a/Lib/mimetypes.py +++ b/Lib/mimetypes.py @@ -567,6 +567,7 @@ def _default_mime_types(): '.tsv' : 'text/tab-separated-values', '.vtt' : 'text/vtt', '.py' : 'text/x-python', + '.rst' : 'text/x-rst', '.etx' : 'text/x-setext', '.sgm' : 'text/x-sgml', '.sgml' : 'text/x-sgml', diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py index 90b983aec1b2..c366698b21b4 100644 --- a/Lib/test/test_mimetypes.py +++ b/Lib/test/test_mimetypes.py @@ -221,6 +221,7 @@ class MimeTypesTestCase(unittest.TestCase): self.assertEqual(mimetypes.guess_extension('message/rfc822'), '.eml') self.assertEqual(mimetypes.guess_extension('text/html'), '.html') self.assertEqual(mimetypes.guess_extension('text/plain'), '.txt') + self.assertEqual(mimetypes.guess_extension('text/x-rst'), '.rst') self.assertEqual(mimetypes.guess_extension('video/mpeg'), '.mpeg') self.assertEqual(mimetypes.guess_extension('video/quicktime'), '.mov') diff --git a/Misc/NEWS.d/next/Library/2024-05-05-16-08-03.gh-issue-101137.71ECXu.rst b/Misc/NEWS.d/next/Library/2024-05-05-16-08-03.gh-issue-101137.71ECXu.rst new file mode 100644 index 000000000000..3df689b2f038 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-05-05-16-08-03.gh-issue-101137.71ECXu.rst @@ -0,0 +1 @@ +Mime type ``text/x-rst`` is now supported by :mod:`mimetypes`.