Skip to content

Commit d545b5b

Browse files
authored
[pylint] add fix safety section (PLE4703) (#17824)
This PR adds a fix safety section in comment for rule PLE4703. parent: #15584 impl was introduced at #970 (couldn't find newer PRs sorry!)
1 parent b2d9f59 commit d545b5b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

crates/ruff_linter/src/rules/pylint/rules/modified_iterating_set.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ use crate::checkers::ast::Checker;
3838
/// nums.add(num + 5)
3939
/// ```
4040
///
41+
/// ## Fix safety
42+
/// This fix is always unsafe because it changes the program’s behavior. Replacing the
43+
/// original set with a copy during iteration allows code that would previously raise a
44+
/// `RuntimeError` to run without error.
45+
///
4146
/// ## References
4247
/// - [Python documentation: `set`](https://docs.python.org/3/library/stdtypes.html#set)
4348
#[derive(ViolationMetadata)]

0 commit comments

Comments
 (0)