Skip to content

[pyflakes] Recognize frozendict as a builtin for Python 3.15+ #24100

Merged
charliermarsh merged 2 commits intoastral-sh:mainfrom
vivekkhimani:vivek/frozen-dict-py315
Mar 21, 2026
Merged

[pyflakes] Recognize frozendict as a builtin for Python 3.15+ #24100
charliermarsh merged 2 commits intoastral-sh:mainfrom
vivekkhimani:vivek/frozen-dict-py315

Conversation

@vivekkhimani
Copy link
Copy Markdown
Contributor

@vivekkhimani vivekkhimani commented Mar 21, 2026

Summary

Register frozendict (PEP 814) as a version-gated builtin for Python 3.15+, fixing F821 when target-version = "py315"

Closes #24095

Test plan

  • frozendict with target-version >= py315 → no diagnostic
  • frozendict with target-version < py315F821 with version hint suggesting py315
  • Existing version-gated builtin tests still pass (e.g. PythonFinalizationError, __annotate__)

Local run

 Nextest run ID ab77447d-80be-48fe-ba42-d98e29697619 with nextest profile: default
    Starting 2 tests across 1 binary (2697 tests skipped)
        PASS [   0.049s] ruff_linter rules::pyflakes::tests::f821_frozendict_py315_available
        PASS [   0.254s] ruff_linter rules::pyflakes::tests::f821_frozendict_pre_py315_undefined

@astral-sh-bot astral-sh-bot bot requested a review from ntBre March 21, 2026 21:13
@vivekkhimani vivekkhimani changed the title frozendict builtin py315 [pyflakes] Recognize frozendict as a builtin for Python 3.15+ Mar 21, 2026
@charliermarsh charliermarsh added the preview Related to preview mode features label Mar 21, 2026
@charliermarsh charliermarsh changed the title [pyflakes] Recognize frozendict as a builtin for Python 3.15+ [pyflakes] Recognize frozendict as a builtin for Python 3.15+ Mar 21, 2026
@charliermarsh
Copy link
Copy Markdown
Member

Thank you!

@charliermarsh charliermarsh enabled auto-merge (squash) March 21, 2026 23:46
@charliermarsh charliermarsh merged commit dd6d843 into astral-sh:main Mar 21, 2026
41 checks passed
nicopauss pushed a commit to Intersec/lib-common that referenced this pull request Apr 1, 2026
##### [\`v0.15.8\`](https://github.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#0158)

Released on 2026-03-26.

##### Preview features

- \[`ruff`] New rule `unnecessary-if` (`RUF050`) ([#24114](astral-sh/ruff#24114))
- \[`ruff`] New rule `useless-finally` (`RUF072`) ([#24165](astral-sh/ruff#24165))
- \[`ruff`] New rule `f-string-percent-format` (`RUF073`): warn when using `%` operator on an f-string ([#24162](astral-sh/ruff#24162))
- \[`pyflakes`] Recognize `frozendict` as a builtin for Python 3.15+ ([#24100](astral-sh/ruff#24100))

##### Bug fixes

- \[`flake8-async`] Use fully-qualified `anyio.lowlevel` import in autofix (`ASYNC115`) ([#24166](astral-sh/ruff#24166))
- \[`flake8-bandit`] Check tuple arguments for partial paths in `S607` ([#24080](astral-sh/ruff#24080))
- \[`pyflakes`] Skip `undefined-name` (`F821`) for conditionally deleted variables ([#24088](astral-sh/ruff#24088))
- `E501`/`W505`/formatter: Exclude nested pragma comments from line width calculation ([#24071](astral-sh/ruff#24071))
- Fix `%foo?` parsing in IPython assignment expressions ([#24152](astral-sh/ruff#24152))
- `analyze graph`: resolve string imports that reference attributes, not just modules ([#24058](astral-sh/ruff#24058))

##### Rule changes

- \[`eradicate`] ignore `ty: ignore` comments in `ERA001` ([#24192](astral-sh/ruff#24192))
- \[`flake8-bandit`] Treat `sys.executable` as trusted input in `S603` ([#24106](astral-sh/ruff#24106))
- \[`flake8-self`] Recognize `Self` annotation and `self` assignment in `SLF001` ([#24144](astral-sh/ruff#24144))
- \[`pyflakes`] `F507`: Fix false negative for non-tuple RHS in `%`-formatting ([#24142](astral-sh/ruff#24142))
- \[`refurb`] Parenthesize generator arguments in `FURB142` fixer ([#24200](astral-sh/ruff#24200))

##### Performance

- Speed up diagnostic rendering ([#24146](astral-sh/ruff#24146))

##### Server

- Warn when Markdown files are skipped due to preview being disabled ([#24150](astral-sh/ruff#24150))

##### Documentation

- Clarify `extend-ignore` and `extend-select` settings documentation ([#24064](astral-sh/ruff#24064))
- Mention AI policy in PR template ([#24198](astral-sh/ruff#24198))

##### Other changes

- Use trusted publishing for NPM packages ([#24171](astral-sh/ruff#24171))

##### Contributors

- [@bitloi](https://github.com/bitloi)
- [@Sim-hu](https://github.com/Sim-hu)
- [@mvanhorn](https://github.com/mvanhorn)
- [@chinar-amrutkar](https://github.com/chinar-amrutkar)
- [@markjm](https://github.com/markjm)
- [@RenzoMXD](https://github.com/RenzoMXD)
- [@vivekkhimani](https://github.com/vivekkhimani)
- [@seroperson](https://github.com/seroperson)
- [@moktamd](https://github.com/moktamd)
- [@charliermarsh](https://github.com/charliermarsh)
- [@ntBre](https://github.com/ntBre)
- [@zanieb](https://github.com/zanieb)
- [@dylwil3](https://github.com/dylwil3)
- [@MichaReiser](https://github.com/MichaReiser)

Renovate-Branch: renovate/2024.6-ruff-0.15.x
Change-Id: Ifd4216a963962ffb24a4df69802bc60fcc29628d
Priv-Id: 46d2f61be3a5e65a9fdd2fef998ba41ea3388f12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Related to preview mode features python315

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for frozendict in Python 3.15

3 participants