Skip to content

1.12 regression related to TypedDictType #17958

Description

@torarvid

Crash Report

Ran mypy as normal: uv run mypy --show-error-codes --show-column-numbers, and got an INTERNAL_ERROR. Never seen it before, so was surprised.

Traceback

❯ uv run mypy --show-error-codes --show-column-numbers --show-traceback
src/hamon/users/managers.py:15: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.12.0
Traceback (most recent call last):
  File "mypy/checkexpr.py", line 5847, in accept
  File "mypy/nodes.py", line 1969, in accept
  File "mypy/checkexpr.py", line 480, in visit_call_expr
  File "mypy/checkexpr.py", line 614, in visit_call_expr_inner
  File "mypy/checkexpr.py", line 1471, in check_call_expr_with_callee_type
  File "mypy/checkexpr.py", line 1565, in check_call
  File "mypy/checkexpr.py", line 1811, in check_callable_call
  File "mypy/checkexpr.py", line 1262, in apply_function_plugin
  File "/Users/torarvid/oda/hardware-monitoring/.venv/lib/python3.12/site-packages/mypy_django_plugin/transformers/querysets.py", line 278, in extract_proper_type_queryset_annotate
    fields_dict = helpers.make_typeddict(api, fields=field_types, required_keys=set(field_types.keys()))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/torarvid/oda/hardware-monitoring/.venv/lib/python3.12/site-packages/mypy_django_plugin/lib/helpers.py", line 405, in make_typeddict
    typed_dict_type = TypedDictType(fields, required_keys=required_keys, fallback=fallback_type)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: __init__() missing required argument 'readonly_keys' (pos 3)

To Reproduce

Sorry, this is in a company repo, so I don't think I'm allowed to just paste in the code. Hope the traceback is enough to help you find it.

Your Environment

  • Mypy version used: 1.12
  • Mypy command-line flags: uv run mypy --show-error-codes --show-column-numbers --show-traceback
  • Mypy configuration options from mypy.ini (and other config files):
[tool.mypy]
python_version = "3.12"
plugins = [
    "mypy_django_plugin.main",
    "pydantic.mypy",
    "strawberry.ext.mypy_plugin",
]
files = ["./src/cli", "./src/hamon", "./src/shared"]
ignore_missing_imports = true
follow_imports = "normal"
strict = true

# Disable typing in migration files generated by Django
[[tool.mypy.overrides]]
module = "hamon.*.migrations.*"
ignore_errors = true
  • Python version used: 3.12.6
  • Operating system and version: macOS 15.0.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions