Skip to content

TypeError: __init__() missing required argument 'default' (pos 6) #15485

Closed as not planned
@romulorosa

Description

@romulorosa

Crash Report
I tried to run mypy --show-traceback since it is breaking on version 1.4.0 (I was using version 1.3.0 before)
(Tell us what happened.)

Traceback

Traceback (most recent call last):
  File "mypy/semanal.py", line 6451, in accept
  File "mypy/nodes.py", line 1139, in accept
  File "mypy/semanal.py", line 1582, in visit_class_def
  File "mypy/semanal.py", line 1667, in analyze_class
  File "mypy/semanal.py", line 1694, in analyze_class_body_common
  File "mypy/semanal.py", line 1777, in apply_class_plugin_hooks
  File "pydantic/mypy.py", line 129, in pydantic.mypy.PydanticPlugin._pydantic_model_class_maker_callback
  File "pydantic/mypy.py", line 262, in pydantic.mypy.PydanticModelTransformer.transform
  File "pydantic/mypy.py", line 441, in pydantic.mypy.PydanticModelTransformer.add_construct_method
TypeError: __init__() missing required argument 'default' (pos 6)

/Users/rrosa/env/lib/python3.11/site-packages/pydantic/env_settings.py:22: 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.4.0
/Users/rrosa/env/lib/python3.11/site-packages/pydantic/env_settings.py:22: : note: use --pdb to drop into pdb

To Reproduce

(Write what you did to reproduce the crash. Full source code is
appreciated. We also very much appreciate it if you try to narrow the
source down to a small stand-alone example.)

Your Environment

  • Mypy version used: 1.4.0
  • Mypy command-line flags: mypy
  • Mypy configuration options from mypy.ini (and other config files):
[mypy]
python_version = 3.11
files = my_project/**/*.py
plugins = pydantic.mypy
disallow_untyped_defs = true
warn_no_return = false
ignore_missing_imports = true
  • Python version used: 3.11.3
  • Operating system and version: MacOS Ventura 13.4 (M1 Pro)

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashtopic-pluginsThe plugin API and ideas for new plugins

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions