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.

Author r.david.murray
Recipients cheryl.sabella, r.david.murray
Date 2017-12-31.16:38:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1514738290.34.0.467229070634.issue32462@psf.upfronthosting.co.za>
In-reply-to
Content
You can get the same "bad" behavior on a posix system by having a mimetypes file with an incorrect entry in it.  That would be a system misconfiguration, as is your Windows registry case, and is outside of Python's control.  I suppose we could make it clearer (ie: in that intro paragraph) that the system files are read by default (that is, the built-in tables are only *defaults* unless you specify otherwise).

It is unfortunately true that the mime types in the Windows registry are less reliable than those on unix systems.  This has nothing to do with the mimetypes module itself, though ;)  I wonder if we should have made the default to be loading windows registry as non-strict, but that ship has sailed, I think.

Checking for at least minimal validity (xxx/yyy) would at least make things a little better on Windows, so I wouldn't object to adding that.

To summarize, my suggestion would be to add a note to the intro paragraph that system files/registry are read by default and override the built-in tables, and add a minimal sanity check on the mime type values read.  Adding .sql to the strict list is a separate issue, and would not change the behavior here (unless I'm missing something, which is possible).

There are issues around adding even a minimal validity check, though: do we backport that?  Do we silently ignore strings in the wrong format?  Do we "fix" a backslash to be a slash?  Do we issue a warning for any problems we find?  These questions should be discussed if we decide to go this route.
History
Date User Action Args
2017-12-31 16:38:10r.david.murraysetrecipients: + r.david.murray, cheryl.sabella
2017-12-31 16:38:10r.david.murraysetmessageid: <1514738290.34.0.467229070634.issue32462@psf.upfronthosting.co.za>
2017-12-31 16:38:10r.david.murraylinkissue32462 messages
2017-12-31 16:38:09r.david.murraycreate