mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Get rig of EnvironmentError (#16705)
This commit is contained in:
parent
6eda46de99
commit
3438fa496d
16 changed files with 34 additions and 35 deletions
|
@ -243,7 +243,7 @@ class MimeTypes:
|
|||
while True:
|
||||
try:
|
||||
ctype = _winreg.EnumKey(mimedb, i)
|
||||
except EnvironmentError:
|
||||
except OSError:
|
||||
break
|
||||
else:
|
||||
yield ctype
|
||||
|
@ -256,7 +256,7 @@ class MimeTypes:
|
|||
with _winreg.OpenKey(mimedb, ctype) as key:
|
||||
suffix, datatype = _winreg.QueryValueEx(key,
|
||||
'Extension')
|
||||
except EnvironmentError:
|
||||
except OSError:
|
||||
continue
|
||||
if datatype != _winreg.REG_SZ:
|
||||
continue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue