mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051)
This commit is contained in:
parent
fdbd01151d
commit
55fe1ae970
36 changed files with 1538 additions and 1538 deletions
|
|
@ -245,7 +245,7 @@ class MimeTypes:
|
|||
while True:
|
||||
try:
|
||||
ctype = _winreg.EnumKey(mimedb, i)
|
||||
except EnvironmentError:
|
||||
except OSError:
|
||||
break
|
||||
else:
|
||||
if '\0' not in ctype:
|
||||
|
|
@ -259,13 +259,13 @@ class MimeTypes:
|
|||
# Only check file extensions
|
||||
if not subkeyname.startswith("."):
|
||||
continue
|
||||
# raises EnvironmentError if no 'Content Type' value
|
||||
# raises OSError if no 'Content Type' value
|
||||
mimetype, datatype = _winreg.QueryValueEx(
|
||||
subkey, 'Content Type')
|
||||
if datatype != _winreg.REG_SZ:
|
||||
continue
|
||||
self.add_type(mimetype, subkeyname, strict)
|
||||
except EnvironmentError:
|
||||
except OSError:
|
||||
continue
|
||||
|
||||
def guess_type(url, strict=True):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue