---
source: crates/ruff/src/rules/pyupgrade/mod.rs
---
UP024_0.py:6:8: UP024 [*] Replace aliased errors with `OSError`
  |
6 | try:
7 |     pass
8 | except EnvironmentError:
  |        ^^^^^^^^^^^^^^^^ UP024
9 |     pass
  |
  = help: Replace `EnvironmentError` with builtin `OSError`

ℹ Suggested fix
3 3 | # These should be fixed
4 4 | try:
5 5 |     pass
6   |-except EnvironmentError:
  6 |+except OSError:
7 7 |     pass
8 8 | 
9 9 | try:

UP024_0.py:11:8: UP024 [*] Replace aliased errors with `OSError`
   |
11 | try:
12 |     pass
13 | except IOError:
   |        ^^^^^^^ UP024
14 |     pass
   |
   = help: Replace `IOError` with builtin `OSError`

ℹ Suggested fix
8  8  | 
9  9  | try:
10 10 |     pass
11    |-except IOError:
   11 |+except OSError:
12 12 |     pass
13 13 | 
14 14 | try:

UP024_0.py:16:8: UP024 [*] Replace aliased errors with `OSError`
   |
16 | try:
17 |     pass
18 | except WindowsError:
   |        ^^^^^^^^^^^^ UP024
19 |     pass
   |
   = help: Replace `WindowsError` with builtin `OSError`

ℹ Suggested fix
13 13 | 
14 14 | try:
15 15 |     pass
16    |-except WindowsError:
   16 |+except OSError:
17 17 |     pass
18 18 | 
19 19 | try:

UP024_0.py:21:8: UP024 [*] Replace aliased errors with `OSError`
   |
21 | try:
22 |     pass
23 | except mmap.error:
   |        ^^^^^^^^^^ UP024
24 |     pass
   |
   = help: Replace `mmap.error` with builtin `OSError`

ℹ Suggested fix
18 18 | 
19 19 | try:
20 20 |     pass
21    |-except mmap.error:
   21 |+except OSError:
22 22 |     pass
23 23 | 
24 24 | try:

UP024_0.py:26:8: UP024 [*] Replace aliased errors with `OSError`
   |
26 | try:
27 |     pass
28 | except select.error:
   |        ^^^^^^^^^^^^ UP024
29 |     pass
   |
   = help: Replace `select.error` with builtin `OSError`

ℹ Suggested fix
23 23 | 
24 24 | try:
25 25 |     pass
26    |-except select.error:
   26 |+except OSError:
27 27 |     pass
28 28 | 
29 29 | try:

UP024_0.py:31:8: UP024 [*] Replace aliased errors with `OSError`
   |
31 | try:
32 |     pass
33 | except socket.error:
   |        ^^^^^^^^^^^^ UP024
34 |     pass
   |
   = help: Replace `socket.error` with builtin `OSError`

ℹ Suggested fix
28 28 | 
29 29 | try:
30 30 |     pass
31    |-except socket.error:
   31 |+except OSError:
32 32 |     pass
33 33 | 
34 34 | try:

UP024_0.py:36:8: UP024 [*] Replace aliased errors with `OSError`
   |
36 | try:
37 |     pass
38 | except error:
   |        ^^^^^ UP024
39 |     pass
   |
   = help: Replace `error` with builtin `OSError`

ℹ Suggested fix
33 33 | 
34 34 | try:
35 35 |     pass
36    |-except error:
   36 |+except OSError:
37 37 |     pass
38 38 | 
39 39 | # Should NOT be in parentheses when replaced

UP024_0.py:43:8: UP024 [*] Replace aliased errors with `OSError`
   |
43 | try:
44 |     pass
45 | except (IOError,):
   |        ^^^^^^^^^^ UP024
46 |     pass
47 | try:
   |
   = help: Replace with builtin `OSError`

ℹ Suggested fix
40 40 | 
41 41 | try:
42 42 |     pass
43    |-except (IOError,):
   43 |+except OSError:
44 44 |     pass
45 45 | try:
46 46 |     pass

UP024_0.py:47:8: UP024 [*] Replace aliased errors with `OSError`
   |
47 | try:
48 |     pass
49 | except (mmap.error,):
   |        ^^^^^^^^^^^^^ UP024
50 |     pass
51 | try:
   |
   = help: Replace with builtin `OSError`

ℹ Suggested fix
44 44 |     pass
45 45 | try:
46 46 |     pass
47    |-except (mmap.error,):
   47 |+except OSError:
48 48 |     pass
49 49 | try:
50 50 |     pass

UP024_0.py:51:8: UP024 [*] Replace aliased errors with `OSError`
   |
51 | try:
52 |     pass
53 | except (EnvironmentError, IOError, OSError, select.error):
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP024
54 |     pass
   |
   = help: Replace with builtin `OSError`

ℹ Suggested fix
48 48 |     pass
49 49 | try:
50 50 |     pass
51    |-except (EnvironmentError, IOError, OSError, select.error):
   51 |+except OSError:
52 52 |     pass
53 53 | 
54 54 | # Should be kept in parentheses (because multiple)

UP024_0.py:58:8: UP024 [*] Replace aliased errors with `OSError`
   |
58 | try:
59 |     pass
60 | except (IOError, KeyError, OSError):
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP024
61 |     pass
   |
   = help: Replace with builtin `OSError`

ℹ Suggested fix
55 55 | 
56 56 | try:
57 57 |     pass
58    |-except (IOError, KeyError, OSError):
   58 |+except (KeyError, OSError):
59 59 |     pass
60 60 | 
61 61 | # First should change, second should not

UP024_0.py:65:8: UP024 [*] Replace aliased errors with `OSError`
   |
65 | try:
66 |     pass
67 | except (IOError, error):
   |        ^^^^^^^^^^^^^^^^ UP024
68 |     pass
69 | # These should not change
   |
   = help: Replace with builtin `OSError`

ℹ Suggested fix
62 62 | from .mmap import error
63 63 | try:
64 64 |     pass
65    |-except (IOError, error):
   65 |+except (OSError, error):
66 66 |     pass
67 67 | # These should not change
68 68 | 

UP024_0.py:87:8: UP024 [*] Replace aliased errors with `OSError`
   |
87 | try:
88 |     pass
89 | except (mmap).error:
   |        ^^^^^^^^^^^^ UP024
90 |     pass
   |
   = help: Replace `mmap.error` with builtin `OSError`

ℹ Suggested fix
84 84 |     pass
85 85 | try:
86 86 |     pass
87    |-except (mmap).error:
   87 |+except OSError:
88 88 |     pass
89 89 | 
90 90 | try:


