# ruff F632: fix changes program behavior

Internal evidence sheet generated by fixhunt. Not an issue text. A human re-verifies, checks the duplicates
below, and writes the upstream report in their own words following the project's AI policy.

- Tool: ruff ruff 0.17.1
- Rule: F632 (tool labels the fix: unknown, this fix reported as safe)
- Oracle: fix-changes-behavior
- Judge (Nemotron 3 Ultra, advisory): intended-change, severity high. The rule rewrites `x is []` to `x == []`, changing an identity comparison to a value comparison. The documentation explicitly states that `is` with literals is incorrect and that `==` should be used instead, so the behavioral change (from False to True) is exactly the semantic change the rule intends.
- Program: minimized from 9 to 6 lines

## Reproducer

```python
__all__ = ['x']
x = []
if x is []:
  print('same object')
del x
from __main__ import *
```

## Commands

```sh
python3 prog.py
ruff check --preview --isolated --select F632 --fix prog.py
python3 prog.py
```

## Observed

```
stdout before:

stdout after:
same object
```

## Diff applied by the fix

```diff
--- orig.py	2026-10-22 13:34:17.421862621 -0400
+++ fixed.py	2026-10-22 13:34:19.520897989 -0400
@@ -1,6 +1,6 @@
 __all__ = ['x']
 x = []
-if x is []:
+if x == []:
   print('same object')
 del x
 from __main__ import *
```

## Why the rewrite is not equivalent (model draft, verify before use)

The original condition `x is []` checks identity; since each literal `[]` creates a new list object, it evaluates to False, so nothing prints. After rewriting to `x == []`, equality compares contents—both lists are empty—so True triggers printing 'same object'. Thus behavior changes because identity versus value equality differ for mutable objects like lists. No other modifications affect output.

## Upstream search

Queries: "F632 fix", "F632 identity comparison list literal", "is empty list check replacement", "list equality vs identity lint"

- related: https://github.com/astral-sh/ruff/issues/12518
  Same rule F632 but different construct: False == 0 comparison instead of list identity check.
- related: https://github.com/astral-sh/ruff/issues/11736
  Same rule F632 but different trigger: panic on invalid syntax rather than behavior-changing fix.
- related: https://github.com/astral-sh/ruff/issues/9374
  Same rule F632 but different defect: infinite loop between == and is on chained comparisons.
- duplicate: https://github.com/astral-sh/ruff/issues/8589
  Same rule F632 and same construct: 'variable is []' identity comparison being incorrectly rewritten to '== []'.
- related: https://github.com/astral-sh/ruff/issues/6891
  Same rule F632 but different defect: infinite loop with E712 on generator expressions.
- related: https://github.com/astral-sh/ruff/issues/1057
  Same rule F632 but different construct: 'value % 2 is 0' modulo comparison causing fix panic.
- related: https://github.com/astral-sh/ruff/pull/8607
  Same rule F632 but different construct: 'None is False' constant comparison stabilization.
- related: https://github.com/astral-sh/ruff/pull/12049
  Same rule F632 but broader stabilization work on 'is' comparisons to lists, not the specific behavior-change fix.

<details><summary>All hits</summary>

- [github, closed] unused-function-argument not silenced by prefixed underscore if variable name is "次" — https://github.com/astral-sh/ruff/issues/28721
- [github, open] Implement Pylint — https://github.com/astral-sh/ruff/issues/970
- [github, closed] Isort rule misses unsorted imports when using user-level ruff.toml file on windows — https://github.com/astral-sh/ruff/issues/19646
- [github, closed] [Feature Idea] Add column headers to `ruff check --statistics`, to avoid ambiguity — https://github.com/astral-sh/ruff/issues/13717
- [github, closed] F632 suggestion leads to false positive when comparing False == 0 — https://github.com/astral-sh/ruff/issues/12518
- [github, closed] Rule F632 cause panic — https://github.com/astral-sh/ruff/issues/11736
- [github, closed] [QA] Should Ruff be able to fix indentation errors (E999) ? — https://github.com/astral-sh/ruff/issues/11846
- [github, closed] Infinite loop in F632/E711 — https://github.com/astral-sh/ruff/issues/9374
- [github, closed] Catch `variable is []` — https://github.com/astral-sh/ruff/issues/8589
- [github, closed] Rules E712,F632 causes infinite loop — https://github.com/astral-sh/ruff/issues/6891
- [tavily] [bug] ruff chokes when fixing invalid comparison (`F632`) · Issue #1057 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/1057
- [tavily] D205 not fixable · Issue #1672 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/1672
- [tavily] Multi-root workspace makes Ruff use wrong settings · Issue #925 · astral-sh/ruff-vscode · GitHub — https://github.com/astral-sh/ruff-vscode/issues/925
- [github, open] Feature: Port Sonar's Python scanner checks — https://github.com/astral-sh/ruff/issues/4935
- [tavily] Add check for is comparison with mutable initialisers to rule F632 by jesse1412 · Pull Request #8607 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/pull/8607
- [tavily] [`pyflakes`] Stabilize detection of is comparisons to lists, etc. (`F632`) by charliermarsh · Pull Request #12049 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/pull/12049
- [github, open] Fixes on Jupyter notebooks cause panics when fix replaces/deletes multiple cells — https://github.com/astral-sh/ruff/issues/14445
- [github, open] Implement flake8-async rules — https://github.com/astral-sh/ruff/issues/8451
- [github, open] Suggestion: Implement Sourcery rules — https://github.com/astral-sh/ruff/issues/11060
- [github, closed] B009 safe fix discards evaluation of ** arguments — https://github.com/astral-sh/ruff/issues/28732
- [github, closed] Airflow 3.0 deprecations — https://github.com/astral-sh/ruff/issues/14626
- [github, closed] Implement flake8-type-checking — https://github.com/astral-sh/ruff/issues/1785
- [github, closed] Update bugbear — https://github.com/astral-sh/ruff/issues/2954
- [tavily] 0.16.0 removed 18 rules from the default set without recording it in BREAKING_CHANGES.md · Issue #27199 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/27199
- [tavily] Implement remaining `pycodestyle` rules · Issue #2402 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/2402

</details>
