with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,
r'MIME\Database\Content Type') as mimedb:
for ctype in enum_types(mimedb):
- with _winreg.OpenKey(mimedb, ctype) as key:
- try:
- suffix, datatype = _winreg.QueryValueEx(key, 'Extension')
- except EnvironmentError:
- continue
- if datatype != _winreg.REG_SZ:
- continue
- self.add_type(ctype, suffix, strict)
+ try:
+ with _winreg.OpenKey(mimedb, ctype) as key:
+ try:
+ suffix, datatype = _winreg.QueryValueEx(key,
+ 'Extension')
+ except EnvironmentError:
+ continue
+ if datatype != _winreg.REG_SZ:
+ continue
+ self.add_type(ctype, suffix, strict)
def guess_type(url, strict=True):
Library
-------
+- Issue #10163: Skip unreadable registry keys during mimetypes
+ initialization.
+
- logging: Made StreamHandler terminator configurable.
- logging: Allowed filters to be just callables.