Skip to content

[ty] Omit invalid keyword arguments from TypedDict signature#24522

Merged
charliermarsh merged 1 commit intomainfrom
charlie/synth
Apr 9, 2026
Merged

[ty] Omit invalid keyword arguments from TypedDict signature#24522
charliermarsh merged 1 commit intomainfrom
charlie/synth

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

Summary

If a TypedDict contains keys that aren't valid keyword arguments, we now omit them from the signature and include an extra **kwargs at the end, as for, e.g., TypedDict("Config", {"in": int, "x-y": str, "ok": int}) (in is a reserved keyword, and x-i contains a dash, so neither are valid keyword arguments).

@astral-sh-bot astral-sh-bot Bot added the ty Multi-file analysis & type inference label Apr 9, 2026
@charliermarsh charliermarsh changed the title [ty] Omit invalid keyword arguments from TypedDict signature [ty] Omit invalid keyword arguments from TypedDict signature Apr 9, 2026
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 9, 2026

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 87.72%. The percentage of expected errors that received a diagnostic held steady at 82.85%. The number of fully passing files held steady at 74/132.

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 9, 2026

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 9, 2026

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@charliermarsh charliermarsh marked this pull request as ready for review April 9, 2026 19:40
@charliermarsh charliermarsh merged commit aa54cef into main Apr 9, 2026
56 checks passed
@charliermarsh charliermarsh deleted the charlie/synth branch April 9, 2026 19:40
@charliermarsh charliermarsh added the server Related to the LSP server label Apr 9, 2026
carljm added a commit that referenced this pull request Apr 10, 2026
* main:
  [ty] Fix bad diagnostic range for incorrect implicit `__init_subclass__` calls (#24541)
  [ty] Add a `SupportedPythonVersion` enum (#24412)
  [ty] Ignore unsupported editor-selected Python versions (#24498)
  [ty] Add snapshots for `__init_subclass__` diagnostics (#24539)
  [ty] Minor fix in tests (#24538)
  [ty] Allow `Final` variable assignments in `__post_init__` (#24529)
  [ty] Expand test suite for assignment errors (#24537)
  [ty] Use `map`, not `__map`, as the name of the mapping parameter in `TypedDict` `__init__` methods (#24535)
  [ty] Rework logic for synthesizing `TypedDict` methods (#24534)
  [flake8-bandit] Fix S103 false positives and negatives in mask analysis (#24424)
  [ty] mdtest.py: update dependencies (#24533)
  Rename patterns and arguments source order iterator method (#24532)
  [ty] Omit invalid keyword arguments from `TypedDict` signature (#24522)
  [ty] support super() in metaclass methods (#24483)
  [ty] Synthesize `__init__` for `TypedDict` (#24476)
carljm added a commit that referenced this pull request Apr 10, 2026
* main:
  Bump typing conformance suite commit to latest upstream (#24553)
  [ty] Reject deleting`Final` attributes (#24508)
  [ty] Respect property deleters in attribute deletion checks (#24500)
  [ty] stop unioning Unknown into types of un-annotated attributes (#24531)
  [ty] Fix bad diagnostic range for incorrect implicit `__init_subclass__` calls (#24541)
  [ty] Add a `SupportedPythonVersion` enum (#24412)
  [ty] Ignore unsupported editor-selected Python versions (#24498)
  [ty] Add snapshots for `__init_subclass__` diagnostics (#24539)
  [ty] Minor fix in tests (#24538)
  [ty] Allow `Final` variable assignments in `__post_init__` (#24529)
  [ty] Expand test suite for assignment errors (#24537)
  [ty] Use `map`, not `__map`, as the name of the mapping parameter in `TypedDict` `__init__` methods (#24535)
  [ty] Rework logic for synthesizing `TypedDict` methods (#24534)
  [flake8-bandit] Fix S103 false positives and negatives in mask analysis (#24424)
  [ty] mdtest.py: update dependencies (#24533)
  Rename patterns and arguments source order iterator method (#24532)
  [ty] Omit invalid keyword arguments from `TypedDict` signature (#24522)
  [ty] support super() in metaclass methods (#24483)
  [ty] Synthesize `__init__` for `TypedDict` (#24476)
ibraheemdev pushed a commit that referenced this pull request Apr 15, 2026
## Summary

If a TypedDict contains keys that aren't valid keyword arguments, we now
omit them from the signature and include an extra `**kwargs` at the end,
as for, e.g., `TypedDict("Config", {"in": int, "x-y": str, "ok": int})`
(`in` is a reserved keyword, and `x-i` contains a dash, so neither are
valid keyword arguments).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server Related to the LSP server ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants