ruff/crates/ruff_python_stdlib/src
Loïc Riegel 2d3466eccf
[`flake8-bugbear`] Accept immutable slice default arguments (`B008`) (#21823)
Closes issue #21565

## Summary

As pointed out in the issue, slices are currently flagged by B008 but
this behavior is incorrect because slices are immutable.

## Test Plan

Added a test case in the "B006_B008.py" fixture. Sorry for the diff in
the snapshots, the only thing that changes in those flies is the line
numbers, though.

You can also test this manually with this file:
```py
# test_slice.py
def c(d=slice(0, 3)): ...
```

```sh
> target/debug/ruff check tmp/test_slice.py --no-cache --select B008
All checks passed!
```
2025-12-08 14:00:43 -05:00
..
sys python_stdlib: update for 3.14 (#18014) 2025-05-11 11:25:54 -05:00
builtins.rs [`pyflakes`] Fix false positives for `__annotate__` (Py3.14+) and `__warningregistry__` (`F821`) (#20154) 2025-09-23 08:16:00 -04:00
identifiers.rs Add an explicit fast path for whitespace to `is_identifier_continuation` (#9532) 2024-01-16 08:23:43 +00:00
keyword.rs [`ruff`] Implemented `used-dummy-variable` (`RUF052`) (#14611) 2024-12-03 08:36:16 +01:00
lib.rs [syntax-errors]: future-feature-not-defined (F407) (#20554) 2025-09-25 13:52:24 -04:00
logging.rs Fix logging rules with whitespace around dot (#6022) 2023-07-24 05:14:48 +00:00
open_mode.rs Use bitshift consistently for bitflag definitions (#14265) 2024-11-11 10:20:17 +00:00
path.rs Harmonise methods for distinguishing different Python source types (#13682) 2024-10-09 13:18:52 +00:00
str.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
typing.rs [`flake8-bugbear`] Accept immutable slice default arguments (`B008`) (#21823) 2025-12-08 14:00:43 -05:00