Title: Python 2.7.7 regression in mimetypes module on Windows
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: tim.golden Nosy List: Daniel.Szoska, Dmitry.Jemerov, Hugo.Lol, Michał.Pasternak, Roman.Evstifeev, Suzumizaki, Vladimir Iofik, Vladimir.Iofik, aclover, adamhj, benjamin.peterson, brian.curtin, eric.araujo, exarkun, foom, frankoid, gcarothers, haypo, jason.coombs, kaizhu, loewis, me21, ned.deily, python-dev,, r.david.murray, shimizukawa, tim.golden, vldmit
Priority: release blocker Keywords: patch

Created on 2014-06-03 14:42 by foom, last changed 2014-06-29 20:04 by benjamin.peterson. This issue is now closed.

File name Uploaded Description Edit loewis, 2014-06-13 20:35
21652.patch Vladimir.Iofik, 2014-06-28 12:48 review
Messages (14)
msg219693 - (view) Author: James Y Knight (foom) Date: 2014-06-03 14:42
The change done for issue9291 in Python 2.7.7 caused the mimetypes.types_map dict to change to contain a mixture of str and unicode objects, rather than just str, as it always had before.

This causes twisted.web to crash when serving static files on Windows. See for the bug report against Twisted.
msg220353 - (view) Author: Gavin Carothers (gcarothers) Date: 2014-06-12 14:20
Issue also exists in Pyramid (any wsgi server/framework) See for Pyramid bug.
msg220383 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-06-12 20:21
If there is a regression to be fixed, there needs to be a patch with a test.  Anyone?
msg220455 - (view) Author: James Y Knight (foom) Date: 2014-06-13 15:32
Reverting the incorrect commit which caused the regression would be a good start.
msg220458 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-06-13 15:53
If I understand correct that patch was itself attempting to fix a regression ;)
msg220462 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2014-06-13 16:03
Only if you have something better to put in its place! That commit was
fixing an existing problem; perhaps not your problem, but someone's. To
revert it would simply move the pain around.

I hope to be able to work on this fairly soon. If anyone else wants to
propose an approach to take this forward, they're welcome to do so.
msg220466 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2014-06-13 16:51
> That commit was fixing an existing problem; perhaps not your problem, but someone's. To revert it would simply move the pain around.

Doesn't the very same logic apply to the original commit?

> I hope to be able to work on this fairly soon.

Thanks.  Much appreciated.
msg220469 - (view) Author: Vladimir Iofik (Vladimir.Iofik) * Date: 2014-06-13 16:59
Did anyone here managed to reproduce the issue?
I tired but I have failed to.
I'm still trying though. 

Anyway I'd start from investigating why a function EnumKey returns Unicode object while according to documentation it should return string.
msg220496 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2014-06-13 20:35
I can reproduce the issue with the attached script. The problem is not that EnumKey returns a Unicode string (which it never does), but that QueryValueEx returns a Unicode string. See for the actual change in question.
msg220539 - (view) Author: Vladimir Iofik (Vladimir.Iofik) * Date: 2014-06-14 09:02
Thanks, Martin. I didn't read the final with enough care. I think the second part of changes (the ones that are around QueryValueEx) should be rolled back. I believe the code was correct at that part.
Tim, what do you think?
msg221314 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2014-06-22 21:29
Vladimir, if you could provide a patch implementing your proposed rollback, that would be appreciated.
msg221783 - (view) Author: Vladimir Iofik (Vladimir.Iofik) * Date: 2014-06-28 12:48
Finally I got environment and some time.
Attaching patch.
msg221890 - (view) Author: Roundup Robot (python-dev) Date: 2014-06-29 20:04
New changeset 1aafbdfba25a by Benjamin Peterson in branch '2.7':
don't allow unicode into type_map on Windows (closes #21652)
msg221892 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2014-06-29 20:04
Thanks Vladimir; I really appreciate your work on these issues.
Date User Action Args
2014-06-29 20:04:39benjamin.petersonsetmessages: + msg221892
2014-06-29 20:04:02python-devsetstatus: open -> closed
resolution: fixed
messages: + msg221890

stage: resolved
2014-06-28 12:48:54Vladimir.Iofiksetfiles: + 21652.patch
keywords: + patch
messages: + msg221783
2014-06-22 21:29:48benjamin.petersonsetmessages: + msg221314
2014-06-14 09:02:54Vladimir.Iofiksetmessages: + msg220539
2014-06-13 20:35:42loewissetfiles: +

messages: + msg220496
2014-06-13 16:59:45Vladimir.Iofiksetnosy: + Vladimir.Iofik
messages: + msg220469
2014-06-13 16:51:25exarkunsetmessages: + msg220466
2014-06-13 16:03:33tim.goldensetmessages: + msg220462
2014-06-13 15:53:44r.david.murraysetmessages: + msg220458
2014-06-13 15:32:14foomsetmessages: + msg220455
2014-06-13 07:36:14tim.goldensetassignee: tim.golden
2014-06-12 20:21:46ned.deilysetpriority: normal -> release blocker
nosy: + benjamin.peterson, ned.deily
messages: + msg220383

2014-06-12 14:20:27gcarotherssetnosy: + gcarothers
messages: + msg220353
2014-06-03 18:03:31exarkunsetnosy: + exarkun
2014-06-03 14:42:12foomcreate