ruff UP038: tool crashes
Hypothesis Nemotron 3 Super predicted to fire did not fire
isinstance(x, (int, float)) must distinguish actual int/float from bool (subclass of int) and Decimal; rewriting preserves type identity but not value semantics.
Program
Output
(no stdout)
(not run)
- fired
- 0 before · 0 after
- runs
- each version twice, same file name, no network
Judge Nemotron 3 Ultra advisory program-bug · low
The linter crashed because rule UP038 was removed from the codebase and cannot be selected, not because of any semantic change to the program. The program itself is trivial (z = True) and contains no isinstance or issubclass calls, so the rule would not have applied even if it existed. The crash is an environment/tooling issue unrelated to the rewrite's correctness.
Explanation Nemotron 3 Super unverified
The original assignment sets z to True; after applying the (nonexistent) fix from rule UP038—which has been removed—no change occurs in source text but the linter crashes due to attempting to invoke a deleted rule. Since the transformation never actually rewrites the code, the program’s behavior remains identical to before any attempted fix. However, because the tool fails to complete linting, any downstream reliance on its output (e.g., assuming the fix was applied or that analysis succeeded) may lead to incorrect conclusions about correctness, effectively altering the perceived semantics of the development process rather than the program itself. No actual runtime difference arises from the diff, as none was produced.
Reproduce
- file
prog.py(the before program)- minimized program
- r1-p005.py
- evidence sheet
- r1-p005.md
- regression fixture
- r1-p005.py the minimized program with a header stating the observed change, for the tool's test suite
python3 prog.py ruff check --preview --isolated --select UP038 --fix prog.py python3 prog.py
Upstream search GitHub issues Tavily Nemotron 3 Super + Ultra
UP038 fix · ruff UP038 unused variable · rule UP038 removal crash · linter autofix deleted rule
- related astral-sh/ruff/issues/13051 Existing report is about outdated documentation for UP038 fix safety, not a tool crash when the rule is removed.
- related astral-sh/ruff/issues/7871 Existing report is about UP038 rewriting code to be slower, not a tool crash due to rule removal.
- duplicate astral-sh/ruff/issues/18349 Existing report describes the same defect: enabling UP038 (a deprecated/removed rule) causes an error/crash because the rule no longer exists.
Details
- program
- Numeric Coercion and Type Checks
- hazard
- isinstance(x, (int, float)) must distinguish actual int/float from bool (subclass of int) and Decimal; rewriting preserves type identity but not value semantics.
- oracle
lint crashed: ruff failed Cause: Rule `UP038` was removed and cannot be selected.- run
- 2026-10-17T21-20-52-142Z-httm-ruff-UP038
generated program (7 lines) and the fix's diff
rule documentation given to the models
# non-pep604-isinstance (UP038) Derived from the **pyupgrade** linter. Fix is always available. ## Removed This rule was removed as using [PEP 604] syntax in `isinstance` and `issubclass` calls isn't recommended practice, and it incorrectly suggests that other typing syntaxes like [PEP 695] would be supported by `isinstance` and `issubclass`. Using the [PEP 604] syntax is also slightly slower. ## What it does Checks for uses of `isinstance` and `issubclass` that take a tuple of types for comparison. ## Why is this bad? Since Python 3.10, `isinstance` and `issubclass` can be passed a `|`-separated union of types, which is consistent with the union operator introduced in [PEP 604]. Note that this results in slower code. Ignore this rule if the performance of an `isinstance` or `issubclass` check is a concern, e.g., in a hot loop. ## Example ```python isinstance(x, (int, float)) ``` Use instead: ```python isinstance(x, int | float) ``` ## Options - `target-version` ## References - [Python documentation: `isinstance`](https://docs.python.org/3/library/functions.html#isinstance) - [Python documentation: `issubclass`](https://docs.python.org/3/library/functions.html#issubclass) [PEP 604]: https://peps.python.org/pep-0604/ [PEP 695]: https://peps.python.org/pep-0695/