# 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 low. The rule rewrites 'is' to '==' for literal comparisons because identity checks against literals are unreliable and will become SyntaxWarnings in Python 3.8. The program's comment acknowledges the original 'is []' comparison always returns False due to new list creation, while the fixed '== []' correctly returns True when the container's data property returns an empty list, demonstrating the intended semantic change from identity to value comparison.
- Program: minimized from 12 to 8 lines

## Reproducer

```python
class Container:
    def __init__(self):
        self._data = None
    @property
    def data(self):
        return [] if self._data is None else self._data
c = Container()
print(c.data is [])   # Always False (new list each time)
```

## Commands

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

## Observed

```
stdout before:
False
stdout after:
True
```

## Diff applied by the fix

```diff
--- orig.py	2026-10-22 13:34:05.095654961 -0400
+++ fixed.py	2026-10-22 13:34:07.218690724 -0400
@@ -5,4 +5,4 @@
     def data(self):
         return [] if self._data is None else self._data
 c = Container()
-print(c.data is [])   # Always False (new list each time)
+print(c.data == [])   # Always False (new list each time)
```

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

The original expression `c.data is []` checks object identity; since `[]` creates a new empty list on each call to `.data`, it never matches the newly created literal in the condition, so the result is always False. After rewriting to `c.data == []`, equality compares values: both sides evaluate to empty lists with identical contents, yielding True despite being distinct objects. Thus the change from identity (`is`) to equality (`==`) alters the program’s observable output.

## Upstream search

Queries: "F632 fix", "F632 property returns new mutable object", "is comparison against literal list in property accessor", "identity check on freshly created container instance"

- related: https://github.com/astral-sh/ruff/issues/12518
  Same rule F632, but defect involves False == 0 comparison, not identity check against a fresh list literal.
- related: https://github.com/astral-sh/ruff/issues/11736
  Same rule F632, but defect is a panic/crash on invalid syntax, not a behavior-changing fix.
- related: https://github.com/astral-sh/ruff/issues/9374
  Same rule F632, but defect is an infinite loop between == and is on chained comparisons, not a fresh-list identity check.
- duplicate: https://github.com/astral-sh/ruff/issues/8589
  Explicitly titled 'Catch variable is []' — the same F632 rewrite (is -> ==) on a fresh list literal from a property/accessor.
- related: https://github.com/astral-sh/ruff/issues/6891
  Same rules F632/E712, but defect is an infinite loop on a generator expression, not a fresh-list identity check.
- related: https://github.com/astral-sh/ruff/issues/1057
  Same rule F632, but defect is a crash extracting CST from a lambda default value from a lambda default, not a behavior-changing 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
- [tavily] Warn against quadratic list summation · Issue #5073 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/5073
- [tavily] complete expression type inference · Issue #244 · astral-sh/ty · GitHub — https://github.com/astral-sh/ruff/issues/12701
- [tavily] [ty] Recognize string-literal types as subtypes of `Sequence[Literal[chars]]` by jhartum · Pull Request #22415 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/pull/22415
- [tavily] [`flake8-simplify`] Fix `SIM905` autofix for `rsplit` creating a reversed list literal by LaBatata101 · Pull Request #18045 · astral-sh/ruff · GitHub — https://redirect.github.com/astral-sh/ruff/pull/18045
- [tavily] Discrepancy between `format` and `check` for a long string literal · Issue #9926 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/9926
- [tavily] `F821` on use of `Literal` with strings, e.g. `Literal['foo']` · Issue #128 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/128
- [tavily] F821 on a `Literal` type that isn't directly imported by the current module · Issue #2105 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/2105
- [tavily] [`ruff`] Expand rule for `list(iterable).pop(0)` idiom (`RUF015`) by robincaloudis · Pull Request #10148 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/pull/10148
- [tavily] TC001-3 runtime-evaluated-decorators not working when an instance is created via a function. · Issue #20637 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/20637
- [tavily] Proposal: Disallow Instance Variable Shadowing of Class Variable Annotations · Issue #18513 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/18513
- [tavily] Trigger violation on mutable values and function calls for non-dataclass attribute defaults · Issue #4053 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/4053
- [tavily] cached-instance-method (B019) for async_lru and aiocache · Issue #16436 · astral-sh/ruff · GitHub — https://github.com/astral-sh/ruff/issues/16436

</details>
