This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: mimetypes.read_mime_types no longer returns a dict
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: doerwalter Nosy List: doerwalter, nnorwitz, spiv
Priority: normal Keywords:

Created on 2003-01-03 14:31 by spiv, last changed 2022-04-10 16:06 by admin. This issue is now closed.

Messages (3)
msg13857 - (view) Author: Andrew Bennetts (spiv) Date: 2003-01-03 14:31
In 2.3a1, the API of the mimetypes module seems to have
changed in a backwards-incompatible way:

Python 2.2.2 (#1, Dec 18 2002, 10:36:37) 
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import mimetypes
>>> type(mimetypes.read_mime_types('/etc/mime.types'))
<type 'dict'>

Python 2.3a1 (#2, Jan  1 2003, 18:44:29) 
[GCC 3.2.2 20021212 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import mimetypes
>>> type(mimetypes.read_mime_types('/etc/mime.types'))
<type 'tuple'>
>>> type(mimetypes.read_mime_types('/etc/mime.types')[0])
<type 'dict'>


That is, for some reason the result is now inside a
tuple.  Obviously this breaks existing code.  

The documentation for read_mime_types still states "The
type map is returned as a dictionary...", so I presume
this is a bug, rather than an intentional change.
msg13858 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2003-01-03 18:18
Logged In: YES 
user_id=33168

Walter, this seems to be a result of your checkin for patch
# 554192.
msg13859 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2003-01-03 19:44
Logged In: YES 
user_id=89016

Fix check in as Lib/mimetypes.py 1.24.
History
Date User Action Args
2022-04-10 16:06:06adminsetgithub: 37705
2003-01-03 14:31:39spivcreate