Skip to content

Commit cba4a93

Browse files
committed
Merge python EnvironmentError, IOError and WindowsError into OSError.
1 parent 3922883 commit cba4a93

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

methods.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def write_modules(module_list):
185185
unregister_cpp += "#ifdef MODULE_" + name.upper() + "_ENABLED\n"
186186
unregister_cpp += "\tunregister_" + name + "_types();\n"
187187
unregister_cpp += "#endif\n"
188-
except IOError:
188+
except OSError:
189189
pass
190190

191191
modules_cpp = """// register_module_types.gen.cpp
@@ -522,7 +522,7 @@ def generate_cpp_hint_file(filename):
522522
try:
523523
with open(filename, "w") as fd:
524524
fd.write("#define GDCLASS(m_class, m_inherits)\n")
525-
except IOError:
525+
except OSError:
526526
print("Could not write cpp.hint file.")
527527

528528

modules/mono/build_scripts/mono_reg_utils.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
def _reg_open_key(key, subkey):
1010
try:
1111
return winreg.OpenKey(key, subkey)
12-
except (WindowsError, OSError):
12+
except OSError:
1313
if platform.architecture()[0] == "32bit":
1414
bitness_sam = winreg.KEY_WOW64_64KEY
1515
else:
@@ -37,7 +37,7 @@ def _find_mono_in_reg(subkey, bits):
3737
with _reg_open_key_bits(winreg.HKEY_LOCAL_MACHINE, subkey, bits) as hKey:
3838
value = winreg.QueryValueEx(hKey, "SdkInstallRoot")[0]
3939
return value
40-
except (WindowsError, OSError):
40+
except OSError:
4141
return None
4242

4343

@@ -48,7 +48,7 @@ def _find_mono_in_reg_old(subkey, bits):
4848
if default_clr:
4949
return _find_mono_in_reg(subkey + "\\" + default_clr, bits)
5050
return None
51-
except (WindowsError, EnvironmentError):
51+
except OSError:
5252
return None
5353

5454

@@ -97,7 +97,7 @@ def find_msbuild_tools_path_reg():
9797
raise ValueError("Cannot find `installationPath` entry")
9898
except ValueError as e:
9999
print("Error reading output from vswhere: " + e.message)
100-
except WindowsError:
100+
except OSError:
101101
pass # Fine, vswhere not found
102102
except (subprocess.CalledProcessError, OSError):
103103
pass
@@ -109,5 +109,5 @@ def find_msbuild_tools_path_reg():
109109
with _reg_open_key(winreg.HKEY_LOCAL_MACHINE, subkey) as hKey:
110110
value = winreg.QueryValueEx(hKey, "MSBuildToolsPath")[0]
111111
return value
112-
except (WindowsError, OSError):
112+
except OSError:
113113
return ""

platform_methods.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def wrapper(target, source, env):
5555
finally:
5656
try:
5757
os.remove(json_path)
58-
except (OSError, IOError) as e:
58+
except OSError as e:
5959
# Do not fail the entire build if it cannot delete a temporary file
6060
print(
6161
"WARNING: Could not delete temporary file: path=%r; [%s] %s" % (json_path, e.__class__.__name__, e)

0 commit comments

Comments
 (0)