mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Issue #16719: Get rid of WindowsError. Use OSError instead
Patch by Serhiy Storchaka.
This commit is contained in:
parent
8a045cb93b
commit
2606a6f197
28 changed files with 79 additions and 87 deletions
|
|
@ -755,7 +755,7 @@ class WindowsRegistryFinder:
|
|||
def _open_registry(cls, key):
|
||||
try:
|
||||
return _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, key)
|
||||
except WindowsError:
|
||||
except OSError:
|
||||
return _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, key)
|
||||
|
||||
@classmethod
|
||||
|
|
@ -769,7 +769,7 @@ class WindowsRegistryFinder:
|
|||
try:
|
||||
with cls._open_registry(key) as hkey:
|
||||
filepath = _winreg.QueryValue(hkey, "")
|
||||
except WindowsError:
|
||||
except OSError:
|
||||
return None
|
||||
return filepath
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue