[Python-Dev] mimetypes broken on Windows

Ben Hoyt benhoyt at gmail.com
Wed Apr 17 00:22:00 CEST 2013

(Sorry if this reply doesn't thread as I intend -- I wasn't configured
to get python-dev emails, so I'm replying to my original with

On Tue, 16 Apr 2013 14:00:53 -0400, Terry Jan Reedy <tjreedy at udel.edu> wrote:
> On 4/15/2013 10:04 PM, Ben Hoyt wrote:
> > So my proposal is simply to get rid of read_windows_registry()
> > altogether, and fall back to the default type mapping in mimetypes.py on
> > Windows systems. This is correct and fast, even if not complete. As
> I basicallly agree, but am not sure what to do about back-compatibility
> considerations. But we do not have to reproduce buggy behavior.

Agreed. What we have is just plain wrong. Dave Chambers' fix is
better, but still problematic.

What we *could* do is implement Dave Chambers' fix in
read_windows_registry(), but not call this by default. So a user would
have to explicitly call it if they really want Windows registry.

But I actually don't think even that's necessary. I honestly can't see
how anyone will be "depending" on the current behaviour, as it's just
plain buggy (.png and .jpg give the wrong mime type). So I don't think
backwards-compatibility is an issue here.

As R. David Murray mentioned, reading the registry is quite new
(Python 2.7 alpha 1, I believe), and has caused several problems
already. There's been encoding issues, and there's even a duplicate of
issue 15207, "part 3" of http://bugs.python.org/issue10551

But yes, I would love to see a Windows Python committer chip in, even
if it's just with "agreed, please provide a patch".


More information about the Python-Dev mailing list