Skip to content

TypeError: analyze_member_access() got an unexpected keyword argument 'msg' #19478

@allanlewis

Description

@allanlewis

Crash Report

Mypy crashes with an internal error. This happens on 1.16.1 and 1.17.0, and I've reproduced it on master.

This appears to be a case of typeddjango/django-stubs#2696, but I wanted to record it here for posterity.

Version:

1.18.0+dev.23e6072cb969aab81b6b07b096f7e6d07d522a46

Traceback

Traceback (most recent call last):
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/bin/mypy", line 8, in <module>
    sys.exit(console_entry())
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/__main__.py", line 15, in console_entry
    main()
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/main.py", line 127, in main
    res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/main.py", line 211, in run_build
    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/build.py", line 191, in build
    result = _build(
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/build.py", line 267, in _build
    graph = dispatch(sources, manager, stdout)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/build.py", line 2939, in dispatch
    process_graph(graph, manager)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/build.py", line 3337, in process_graph
    process_stale_scc(graph, scc, manager)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/build.py", line 3438, in process_stale_scc
    graph[id].type_check_first_pass()
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/build.py", line 2311, in type_check_first_pass
    self.type_checker().check_first_pass()
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 483, in check_first_pass
    self.accept(d)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 590, in accept
    stmt.accept(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/nodes.py", line 1249, in accept
    return visitor.visit_class_def(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 2560, in visit_class_def
    self.accept(defn.defs)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 590, in accept
    stmt.accept(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/nodes.py", line 1330, in accept
    return visitor.visit_block(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 3021, in visit_block
    self.accept(s)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 590, in accept
    stmt.accept(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/nodes.py", line 976, in accept
    return visitor.visit_decorator(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 5260, in visit_decorator
    self.visit_decorator_inner(e)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 5267, in visit_decorator_inner
    self.check_func_item(e.func, name=e.func.name, allow_empty=allow_empty)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 1177, in check_func_item
    self.check_func_def(defn, typ, name, allow_empty)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 1468, in check_func_def
    self.accept(item.body)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 590, in accept
    stmt.accept(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/nodes.py", line 1330, in accept
    return visitor.visit_block(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 3021, in visit_block
    self.accept(s)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 590, in accept
    stmt.accept(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/nodes.py", line 1598, in accept
    return visitor.visit_if_stmt(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 4862, in visit_if_stmt
    self.accept(b)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 590, in accept
    stmt.accept(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/nodes.py", line 1330, in accept
    return visitor.visit_block(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 3021, in visit_block
    self.accept(s)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 590, in accept
    stmt.accept(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/nodes.py", line 1686, in accept
    return visitor.visit_with_stmt(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 5393, in visit_with_stmt
    self.accept(s.body)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 590, in accept
    stmt.accept(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/nodes.py", line 1330, in accept
    return visitor.visit_block(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 3021, in visit_block
    self.accept(s)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 590, in accept
    stmt.accept(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/nodes.py", line 1417, in accept
    return visitor.visit_assignment_stmt(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 3070, in visit_assignment_stmt
    self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None, s.new_syntax)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checker.py", line 3282, in check_assignment
    rvalue_type = self.expr_checker.accept(rvalue, type_context=type_context)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkexpr.py", line 5981, in accept
    typ = node.accept(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/nodes.py", line 2385, in accept
    return visitor.visit_dict_expr(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkexpr.py", line 5326, in visit_dict_expr
    dt = self.fast_dict_type(e)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkexpr.py", line 5277, in fast_dict_type
    values.append(self.accept(value))
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkexpr.py", line 5981, in accept
    typ = node.accept(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/nodes.py", line 2368, in accept
    return visitor.visit_list_expr(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkexpr.py", line 5051, in visit_list_expr
    return self.check_lst_expr(e, "builtins.list", "<list>")
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkexpr.py", line 5092, in check_lst_expr
    t = self.fast_container_type(e, fullname)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkexpr.py", line 5081, in fast_container_type
    values.append(self.accept(item))
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkexpr.py", line 5981, in accept
    typ = node.accept(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/nodes.py", line 2039, in accept
    return visitor.visit_call_expr(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkexpr.py", line 519, in visit_call_expr
    return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkexpr.py", line 609, in visit_call_expr_inner
    self.accept(e.callee, type_context, always_allow_any=True, is_callee=True)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkexpr.py", line 5981, in accept
    typ = node.accept(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/nodes.py", line 1963, in accept
    return visitor.visit_member_expr(self)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkexpr.py", line 3335, in visit_member_expr
    result = self.analyze_ordinary_member_access(e, is_lvalue)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkexpr.py", line 3365, in analyze_ordinary_member_access
    member_type = analyze_member_access(
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkmember.py", line 224, in analyze_member_access
    result = _analyze_member_access(name, typ, mx, override_info)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkmember.py", line 241, in _analyze_member_access
    return analyze_instance_member_access(name, typ, mx, override_info)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkmember.py", line 379, in analyze_instance_member_access
    return analyze_member_var_access(name, typ, info, mx)
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy/checkmember.py", line 593, in analyze_member_var_access
    result = hook(
  File "/Users/allanlewis/Library/Caches/pypoetry/virtualenvs/files-i8byh22h-py3.9/lib/python3.9/site-packages/mypy_django_plugin/transformers/functional.py", line 23, in resolve_str_promise_attribute
    return analyze_member_access(
TypeError: analyze_member_access() got an unexpected keyword argument 'msg'

To Reproduce

with ctx():
    a = ({
        'b': [
            _('{c} {d}').format(c='c', d='d'),
        ],
    })
    raise Exception(a)

(I've obfuscated var names and strings.)

Your Environment

  • Mypy version used: 1.18.0+dev.23e6072cb969aab81b6b07b096f7e6d07d522a46
  • Mypy command-line flags: --show-traceback
  • Mypy configuration options from mypy.ini (and other config files):

pyproject.toml:

[tool.mypy]
check_untyped_defs = true
exclude = [
  "<REDACTED>",
]
plugins = [
  "mypy_django_plugin.main",
  "mypy_drf_plugin.main",
]
pretty = true
show_error_codes = true
show_error_context = true
warn_unused_ignores = true

[[tool.mypy.overrides]]
module = [
  "<REDACTED>",
]
ignore_missing_imports = true

[tool.django-stubs]
django_settings_module = "settings"
  • Python version used: 3.9.22
  • Operating system and version: MacOS Sequoia 15.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashpendingIssues that may be closed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy