Skip to content

Commit f1014ce

Browse files
authored
[pylint] Stabilize shallow-copy-environ (PLW1507) (#16627)
Summary -- Stabilizes PLW1507. The tests were already in the right place, and I just tidied the docs a little bit. Test Plan -- 1 issue from 2 weeks ago but just suggesting to mark the fix unsafe. The shallow vs deep copy *does* change the program behavior, just usually in a preferable way.
1 parent afb7da8 commit f1014ce

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

crates/ruff_linter/src/codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
288288
(Pylint, "W0642") => (RuleGroup::Stable, rules::pylint::rules::SelfOrClsAssignment),
289289
(Pylint, "W0711") => (RuleGroup::Stable, rules::pylint::rules::BinaryOpException),
290290
(Pylint, "W1501") => (RuleGroup::Stable, rules::pylint::rules::BadOpenMode),
291-
(Pylint, "W1507") => (RuleGroup::Preview, rules::pylint::rules::ShallowCopyEnviron),
291+
(Pylint, "W1507") => (RuleGroup::Stable, rules::pylint::rules::ShallowCopyEnviron),
292292
(Pylint, "W1508") => (RuleGroup::Stable, rules::pylint::rules::InvalidEnvvarDefault),
293293
(Pylint, "W1509") => (RuleGroup::Stable, rules::pylint::rules::SubprocessPopenPreexecFn),
294294
(Pylint, "W1510") => (RuleGroup::Stable, rules::pylint::rules::SubprocessRunWithoutCheck),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::checkers::ast::Checker;
1313
/// `os.environ` is not a `dict` object, but rather, a proxy object. As such, mutating a shallow
1414
/// copy of `os.environ` will also mutate the original object.
1515
///
16-
/// See: [#15373] for more information.
16+
/// See [BPO 15373] for more information.
1717
///
1818
/// ## Example
1919
/// ```python
@@ -41,7 +41,7 @@ use crate::checkers::ast::Checker;
4141
/// - [Python documentation: `copy` — Shallow and deep copy operations](https://docs.python.org/3/library/copy.html)
4242
/// - [Python documentation: `os.environ`](https://docs.python.org/3/library/os.html#os.environ)
4343
///
44-
/// [#15373]: https://bugs.python.org/issue15373
44+
/// [BPO 15373]: https://bugs.python.org/issue15373
4545
#[derive(ViolationMetadata)]
4646
pub(crate) struct ShallowCopyEnviron;
4747

0 commit comments

Comments
 (0)