Message121929
| Author |
aclover |
| Recipients |
aclover |
| Date |
2010年11月21日.14:10:23 |
| SpamBayes Score |
1.0149397e-05 |
| Marked as misclassified |
No |
| Message-id |
<1290348624.99.0.246792937165.issue10490@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The `enum_types` function in `MimeTypes.read_windows_registry` tries to `.encode` the results of `EnumKey`, assuming it to be a Unicode string.
However, `_winreg.EnumKey` in Python 2.x actually returns a byte string (straight from the ANSI version of the registry interface). Consequently, if there is a MIME type registered with a non-ASCII character in its name (invalid, but not unheard of), initialising `MimeTypes` will raise a `UnicodeDecodeError`. This is not caught (it is only expecting a `UnicodeEncodeError`), so it bombs out whatever module indirectly caused `mimetypes.init()` to be called.
This attempt to `.encode` the `ctype` should simply be removed. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2010年11月21日 14:10:25 | aclover | set | recipients:
+ aclover |
| 2010年11月21日 14:10:24 | aclover | set | messageid: <1290348624.99.0.246792937165.issue10490@psf.upfronthosting.co.za> |
| 2010年11月21日 14:10:23 | aclover | link | issue10490 messages |
| 2010年11月21日 14:10:23 | aclover | create |
|