Files
ruff/crates/ruff_python_semantic
Dylan 1a2e402cfe [pyflakes] Skip undefined-name (F821) for conditionally deleted variables (#24088)
We already skip `F821` for things like this:

```python
x = 1
if cond:
    del x
print(x) # no diagnostic here
```

But when we checked for "conditional branches" we were only looking for
`match`, `if`, and `while` statements.

Here we also check for except handlers and `else` clauses. We continue
to regard `try` statements as "unconditionally executing" even though
that's not quite true.

Closes #6242

As an aside: I originally wanted to use the `BindingKind` variant
`ConditionalDeletion` introduced way back in #10415, but it turns out we
never actually constructed an instance of it! We could, if we ever
needed to track the "thing that was conditionally deleted". But since
that doesn't seem to have ever arisen in practice, I just got rid of the
variant and its references altogether.
2026-03-21 08:17:32 -05:00
..
2026-01-02 19:58:15 +00:00