---
source: crates/ruff_linter/src/rules/pylint/mod.rs
---
PLR1722 [*] Use `sys.exit()` instead of `exit`
 --> sys_exit_alias_16.py:3:5
  |
1 | def test_case_1():
2 |     # comments preserved with a positional argument
3 |     exit(  # comment
  |     ^^^^
4 |         1,  # 2
5 |     )  # 3
  |
help: Replace `exit` with `sys.exit()`
  |
1 + import sys
2 | def test_case_1():
3 |     # comments preserved with a positional argument
  -     exit(  # comment
4 +     sys.exit(  # comment
5 |         1,  # 2
  |
note: This is an unsafe fix and may change runtime behavior

PLR1722 [*] Use `sys.exit()` instead of `exit`
  --> sys_exit_alias_16.py:10:5
   |
 8 | def test_case_2():
 9 |     # comments preserved with a single keyword argument
10 |     exit(  # comment
   |     ^^^^
11 |         code=1,  # 2
12 |     )  # 3
   |
help: Replace `exit` with `sys.exit()`
   |
1  + import sys
2  | def test_case_1():
--------------------------------------------------------------------------------
10 |     # comments preserved with a single keyword argument
   -     exit(  # comment
   -         code=1,  # 2
11 +     sys.exit(  # comment
12 +         1,  # 2
13 |     )  # 3
   |
note: This is an unsafe fix and may change runtime behavior

PLR1722 Use `sys.exit()` instead of `exit`
  --> sys_exit_alias_16.py:17:5
   |
15 | def test_case_3():
16 |     # no diagnostic for multiple arguments
17 |     exit(2, 3, 4)
   |     ^^^^
   |
help: Replace `exit` with `sys.exit()`

PLR1722 [*] Use `sys.exit()` instead of `exit`
  --> sys_exit_alias_16.py:23:5
   |
21 |     # this should now be fixable
22 |     codes = [1]
23 |     exit(*codes)
   |     ^^^^
   |
help: Replace `exit` with `sys.exit()`
   |
1  + import sys
2  | def test_case_1():
--------------------------------------------------------------------------------
23 |     codes = [1]
   -     exit(*codes)
24 +     sys.exit(*codes)
   |
note: This is an unsafe fix and may change runtime behavior
