[Python-bugs-list] [ python-Bugs-661630 ] mimetypes.read_mime_types no longer returns a dict

SourceForge.net noreply@sourceforge.net
Fri, 03 Jan 2003 10:18:49 -0800


Bugs item #661630, was opened at 2003-01-03 09:31
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=661630&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Andrew Bennetts (spiv)
>Assigned to: Walter Dörwald (doerwalter)
Summary: mimetypes.read_mime_types no longer returns a dict

Initial Comment:
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.


----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2003-01-03 13:18

Message:
Logged In: YES 
user_id=33168

Walter, this seems to be a result of your checkin for patch
# 554192.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=661630&group_id=5470