---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
snapshot_kind: text
---
UP024_2.py:10:7: UP024 [*] Replace aliased errors with `OSError`
   |
 8 | # Testing the modules
 9 | import socket, mmap, select
10 | raise socket.error
   |       ^^^^^^^^^^^^ UP024
11 | raise mmap.error
12 | raise select.error
   |
   = help: Replace `socket.error` with builtin `OSError`

ℹ Safe fix
7  7  | 
8  8  | # Testing the modules
9  9  | import socket, mmap, select
10    |-raise socket.error
   10 |+raise OSError
11 11 | raise mmap.error
12 12 | raise select.error
13 13 | 

UP024_2.py:11:7: UP024 [*] Replace aliased errors with `OSError`
   |
 9 | import socket, mmap, select
10 | raise socket.error
11 | raise mmap.error
   |       ^^^^^^^^^^ UP024
12 | raise select.error
   |
   = help: Replace `mmap.error` with builtin `OSError`

ℹ Safe fix
8  8  | # Testing the modules
9  9  | import socket, mmap, select
10 10 | raise socket.error
11    |-raise mmap.error
   11 |+raise OSError
12 12 | raise select.error
13 13 | 
14 14 | raise socket.error()

UP024_2.py:12:7: UP024 [*] Replace aliased errors with `OSError`
   |
10 | raise socket.error
11 | raise mmap.error
12 | raise select.error
   |       ^^^^^^^^^^^^ UP024
13 | 
14 | raise socket.error()
   |
   = help: Replace `select.error` with builtin `OSError`

ℹ Safe fix
9  9  | import socket, mmap, select
10 10 | raise socket.error
11 11 | raise mmap.error
12    |-raise select.error
   12 |+raise OSError
13 13 | 
14 14 | raise socket.error()
15 15 | raise mmap.error(1)

UP024_2.py:14:7: UP024 [*] Replace aliased errors with `OSError`
   |
12 | raise select.error
13 | 
14 | raise socket.error()
   |       ^^^^^^^^^^^^ UP024
15 | raise mmap.error(1)
16 | raise select.error(1, 2)
   |
   = help: Replace `socket.error` with builtin `OSError`

ℹ Safe fix
11 11 | raise mmap.error
12 12 | raise select.error
13 13 | 
14    |-raise socket.error()
   14 |+raise OSError()
15 15 | raise mmap.error(1)
16 16 | raise select.error(1, 2)
17 17 | 

UP024_2.py:15:7: UP024 [*] Replace aliased errors with `OSError`
   |
14 | raise socket.error()
15 | raise mmap.error(1)
   |       ^^^^^^^^^^ UP024
16 | raise select.error(1, 2)
   |
   = help: Replace `mmap.error` with builtin `OSError`

ℹ Safe fix
12 12 | raise select.error
13 13 | 
14 14 | raise socket.error()
15    |-raise mmap.error(1)
   15 |+raise OSError(1)
16 16 | raise select.error(1, 2)
17 17 | 
18 18 | raise socket.error(

UP024_2.py:16:7: UP024 [*] Replace aliased errors with `OSError`
   |
14 | raise socket.error()
15 | raise mmap.error(1)
16 | raise select.error(1, 2)
   |       ^^^^^^^^^^^^ UP024
17 | 
18 | raise socket.error(
   |
   = help: Replace `select.error` with builtin `OSError`

ℹ Safe fix
13 13 | 
14 14 | raise socket.error()
15 15 | raise mmap.error(1)
16    |-raise select.error(1, 2)
   16 |+raise OSError(1, 2)
17 17 | 
18 18 | raise socket.error(
19 19 |     1,

UP024_2.py:18:7: UP024 [*] Replace aliased errors with `OSError`
   |
16 | raise select.error(1, 2)
17 | 
18 | raise socket.error(
   |       ^^^^^^^^^^^^ UP024
19 |     1,
20 |     2,
   |
   = help: Replace `socket.error` with builtin `OSError`

ℹ Safe fix
15 15 | raise mmap.error(1)
16 16 | raise select.error(1, 2)
17 17 | 
18    |-raise socket.error(
   18 |+raise OSError(
19 19 |     1,
20 20 |     2,
21 21 |     3,

UP024_2.py:25:7: UP024 [*] Replace aliased errors with `OSError`
   |
24 | from mmap import error
25 | raise error
   |       ^^^^^ UP024
26 | 
27 | from socket import error
   |
   = help: Replace `error` with builtin `OSError`

ℹ Safe fix
22 22 | )
23 23 | 
24 24 | from mmap import error
25    |-raise error
   25 |+raise OSError
26 26 | 
27 27 | from socket import error
28 28 | raise error(1)

UP024_2.py:28:7: UP024 [*] Replace aliased errors with `OSError`
   |
27 | from socket import error
28 | raise error(1)
   |       ^^^^^ UP024
29 | 
30 | from select import error
   |
   = help: Replace `error` with builtin `OSError`

ℹ Safe fix
25 25 | raise error
26 26 | 
27 27 | from socket import error
28    |-raise error(1)
   28 |+raise OSError(1)
29 29 | 
30 30 | from select import error
31 31 | raise error(1, 2)

UP024_2.py:31:7: UP024 [*] Replace aliased errors with `OSError`
   |
30 | from select import error
31 | raise error(1, 2)
   |       ^^^^^ UP024
32 | 
33 | # Testing the names
   |
   = help: Replace `error` with builtin `OSError`

ℹ Safe fix
28 28 | raise error(1)
29 29 | 
30 30 | from select import error
31    |-raise error(1, 2)
   31 |+raise OSError(1, 2)
32 32 | 
33 33 | # Testing the names
34 34 | raise EnvironmentError

UP024_2.py:34:7: UP024 [*] Replace aliased errors with `OSError`
   |
33 | # Testing the names
34 | raise EnvironmentError
   |       ^^^^^^^^^^^^^^^^ UP024
35 | raise IOError
36 | raise WindowsError
   |
   = help: Replace `EnvironmentError` with builtin `OSError`

ℹ Safe fix
31 31 | raise error(1, 2)
32 32 | 
33 33 | # Testing the names
34    |-raise EnvironmentError
   34 |+raise OSError
35 35 | raise IOError
36 36 | raise WindowsError
37 37 | 

UP024_2.py:35:7: UP024 [*] Replace aliased errors with `OSError`
   |
33 | # Testing the names
34 | raise EnvironmentError
35 | raise IOError
   |       ^^^^^^^ UP024
36 | raise WindowsError
   |
   = help: Replace `IOError` with builtin `OSError`

ℹ Safe fix
32 32 | 
33 33 | # Testing the names
34 34 | raise EnvironmentError
35    |-raise IOError
   35 |+raise OSError
36 36 | raise WindowsError
37 37 | 
38 38 | raise EnvironmentError()

UP024_2.py:36:7: UP024 [*] Replace aliased errors with `OSError`
   |
34 | raise EnvironmentError
35 | raise IOError
36 | raise WindowsError
   |       ^^^^^^^^^^^^ UP024
37 | 
38 | raise EnvironmentError()
   |
   = help: Replace `WindowsError` with builtin `OSError`

ℹ Safe fix
33 33 | # Testing the names
34 34 | raise EnvironmentError
35 35 | raise IOError
36    |-raise WindowsError
   36 |+raise OSError
37 37 | 
38 38 | raise EnvironmentError()
39 39 | raise IOError(1)

UP024_2.py:38:7: UP024 [*] Replace aliased errors with `OSError`
   |
36 | raise WindowsError
37 | 
38 | raise EnvironmentError()
   |       ^^^^^^^^^^^^^^^^ UP024
39 | raise IOError(1)
40 | raise WindowsError(1, 2)
   |
   = help: Replace `EnvironmentError` with builtin `OSError`

ℹ Safe fix
35 35 | raise IOError
36 36 | raise WindowsError
37 37 | 
38    |-raise EnvironmentError()
   38 |+raise OSError()
39 39 | raise IOError(1)
40 40 | raise WindowsError(1, 2)
41 41 | 

UP024_2.py:39:7: UP024 [*] Replace aliased errors with `OSError`
   |
38 | raise EnvironmentError()
39 | raise IOError(1)
   |       ^^^^^^^ UP024
40 | raise WindowsError(1, 2)
   |
   = help: Replace `IOError` with builtin `OSError`

ℹ Safe fix
36 36 | raise WindowsError
37 37 | 
38 38 | raise EnvironmentError()
39    |-raise IOError(1)
   39 |+raise OSError(1)
40 40 | raise WindowsError(1, 2)
41 41 | 
42 42 | raise EnvironmentError(

UP024_2.py:40:7: UP024 [*] Replace aliased errors with `OSError`
   |
38 | raise EnvironmentError()
39 | raise IOError(1)
40 | raise WindowsError(1, 2)
   |       ^^^^^^^^^^^^ UP024
41 | 
42 | raise EnvironmentError(
   |
   = help: Replace `WindowsError` with builtin `OSError`

ℹ Safe fix
37 37 | 
38 38 | raise EnvironmentError()
39 39 | raise IOError(1)
40    |-raise WindowsError(1, 2)
   40 |+raise OSError(1, 2)
41 41 | 
42 42 | raise EnvironmentError(
43 43 |     1,

UP024_2.py:42:7: UP024 [*] Replace aliased errors with `OSError`
   |
40 | raise WindowsError(1, 2)
41 | 
42 | raise EnvironmentError(
   |       ^^^^^^^^^^^^^^^^ UP024
43 |     1,
44 |     2,
   |
   = help: Replace `EnvironmentError` with builtin `OSError`

ℹ Safe fix
39 39 | raise IOError(1)
40 40 | raise WindowsError(1, 2)
41 41 | 
42    |-raise EnvironmentError(
   42 |+raise OSError(
43 43 |     1,
44 44 |     2,
45 45 |     3,

UP024_2.py:48:7: UP024 [*] Replace aliased errors with `OSError`
   |
46 | )
47 | 
48 | raise WindowsError
   |       ^^^^^^^^^^^^ UP024
49 | raise EnvironmentError(1)
50 | raise IOError(1, 2)
   |
   = help: Replace `WindowsError` with builtin `OSError`

ℹ Safe fix
45 45 |     3,
46 46 | )
47 47 | 
48    |-raise WindowsError
   48 |+raise OSError
49 49 | raise EnvironmentError(1)
50 50 | raise IOError(1, 2)

UP024_2.py:49:7: UP024 [*] Replace aliased errors with `OSError`
   |
48 | raise WindowsError
49 | raise EnvironmentError(1)
   |       ^^^^^^^^^^^^^^^^ UP024
50 | raise IOError(1, 2)
   |
   = help: Replace `EnvironmentError` with builtin `OSError`

ℹ Safe fix
46 46 | )
47 47 | 
48 48 | raise WindowsError
49    |-raise EnvironmentError(1)
   49 |+raise OSError(1)
50 50 | raise IOError(1, 2)

UP024_2.py:50:7: UP024 [*] Replace aliased errors with `OSError`
   |
48 | raise WindowsError
49 | raise EnvironmentError(1)
50 | raise IOError(1, 2)
   |       ^^^^^^^ UP024
   |
   = help: Replace `IOError` with builtin `OSError`

ℹ Safe fix
47 47 | 
48 48 | raise WindowsError
49 49 | raise EnvironmentError(1)
50    |-raise IOError(1, 2)
   50 |+raise OSError(1, 2)
