Title: Internal error on dataclass nested in function · Issue #8703 · python/mypy · GitHub
Open Graph Title: Internal error on dataclass nested in function · Issue #8703 · python/mypy
X Title: Internal error on dataclass nested in function · Issue #8703 · python/mypy
Description: Note: if you are reporting a wrong signature of a function or a class in the standard library, then the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues Please provide more information to help ...
Open Graph Description: Note: if you are reporting a wrong signature of a function or a class in the standard library, then the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues ...
X Description: Note: if you are reporting a wrong signature of a function or a class in the standard library, then the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues ...
Opengraph URL: https://github.com/python/mypy/issues/8703
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Internal error on dataclass nested in function","articleBody":"Note: if you are reporting a wrong signature of a function or a class in\r\nthe standard library, then the typeshed tracker is better suited\r\nfor this report: https://github.com/python/typeshed/issues\r\n\r\nPlease provide more information to help us understand the issue:\r\n\r\n* Are you reporting a bug, or opening a feature request?\r\n\r\nReporting a bug\r\n\r\n* Please insert below the code you are checking with mypy,\r\n or a mock-up repro if the source is private. We would appreciate\r\n if you try to simplify your case to a minimal repro.\r\n\r\n```\r\nfrom typing import List, Union\r\nfrom dataclasses import dataclass, field\r\n\r\n\r\ndef foo():\r\n @dataclass\r\n class Foo:\r\n foo: int\r\n\r\n def __call__(self) -> asdf:\r\n ...\r\n```\r\n\r\n* What is the actual behavior/output?\r\n```\r\nnoes-MBP:mypy noe$ mypy ~/test.py --show-traceback\r\nDeferral trace:\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n test:10\r\n/Users/noe/test.py: error: INTERNAL ERROR: maximum semantic analysis iteration count reached\r\n/Users/noe/test.py: error: INTERNAL ERROR -- Please try using mypy master on Github:\r\nhttps://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build\r\nPlease report a bug at https://github.com/python/mypy/issues\r\nversion: 0.770+dev.69eb6fe8a8d7d091e2902b490ad6b43e6fed3d41\r\nTraceback (most recent call last):\r\n File \"/Users/noe/.pyenv/versions/mypy/bin/mypy\", line 10, in \u003cmodule>\r\n sys.exit(console_entry())\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/__main__.py\", line 8, in console_entry\r\n main(None, sys.stdout, sys.stderr)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/main.py\", line 89, in main\r\n res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/build.py\", line 181, in build\r\n sources, options, alt_lib_path, flush_errors, fscache, stdout, stderr, extra_plugins\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/build.py\", line 252, in _build\r\n graph = dispatch(sources, manager, stdout)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/build.py\", line 2626, in dispatch\r\n process_graph(graph, manager)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/build.py\", line 2949, in process_graph\r\n process_stale_scc(graph, scc, manager)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/build.py\", line 3041, in process_stale_scc\r\n mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/semanal_main.py\", line 84, in semantic_analysis_for_scc\r\n check_type_arguments(graph, scc, errors)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/semanal_main.py\", line 360, in check_type_arguments\r\n state.tree.accept(analyzer)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/lib/python3.7/contextlib.py\", line 130, in __exit__\r\n self.gen.throw(type, value, traceback)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/build.py\", line 1919, in wrap_context\r\n yield\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/semanal_main.py\", line 360, in check_type_arguments\r\n state.tree.accept(analyzer)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/nodes.py\", line 294, in accept\r\n return visitor.visit_mypy_file(self)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/semanal_typeargs.py\", line 39, in visit_mypy_file\r\n super().visit_mypy_file(o)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/traverser.py\", line 35, in visit_mypy_file\r\n d.accept(self)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/nodes.py\", line 676, in accept\r\n return visitor.visit_func_def(self)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/traverser.py\", line 54, in visit_func_def\r\n self.visit_func(o)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/semanal_typeargs.py\", line 46, in visit_func\r\n super().visit_func(defn)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/mixedtraverser.py\", line 22, in visit_func\r\n super().visit_func(o)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/traverser.py\", line 51, in visit_func\r\n o.body.accept(self)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/nodes.py\", line 1004, in accept\r\n return visitor.visit_block(self)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/semanal_typeargs.py\", line 54, in visit_block\r\n super().visit_block(o)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/traverser.py\", line 39, in visit_block\r\n s.accept(self)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/nodes.py\", line 939, in accept\r\n return visitor.visit_class_def(self)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/semanal_typeargs.py\", line 50, in visit_class_def\r\n super().visit_class_def(defn)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/mixedtraverser.py\", line 28, in visit_class_def\r\n super().visit_class_def(o)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/traverser.py\", line 71, in visit_class_def\r\n o.defs.accept(self)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/nodes.py\", line 1004, in accept\r\n return visitor.visit_block(self)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/semanal_typeargs.py\", line 54, in visit_block\r\n super().visit_block(o)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/traverser.py\", line 39, in visit_block\r\n s.accept(self)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/nodes.py\", line 676, in accept\r\n return visitor.visit_func_def(self)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/traverser.py\", line 54, in visit_func_def\r\n self.visit_func(o)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/semanal_typeargs.py\", line 46, in visit_func\r\n super().visit_func(defn)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/mixedtraverser.py\", line 23, in visit_func\r\n self.visit_optional_type(o.type)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/mixedtraverser.py\", line 91, in visit_optional_type\r\n t.accept(self)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/types.py\", line 1098, in accept\r\n return visitor.visit_callable_type(self)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/typetraverser.py\", line 52, in visit_callable_type\r\n t.fallback.accept(self)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/types.py\", line 794, in accept\r\n return visitor.visit_instance(self)\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/semanal_typeargs.py\", line 70, in visit_instance\r\n for (i, arg), tvar in zip(enumerate(t.args), info.defn.type_vars):\r\n File \"/Users/noe/.pyenv/versions/3.7.3/envs/mypy/lib/python3.7/site-packages/mypy/nodes.py\", line 2659, in __getattribute__\r\n raise AssertionError(object.__getattribute__(self, 'msg'))\r\nAssertionError: fallback can't be filled out until semanal\r\n/Users/noe/test.py: : note: use --pdb to drop into pdb\r\n```\r\n\r\n* What is the behavior/output you expect?\r\n\r\n```\r\n/Users/noe/test.py:10: error: Name 'asdf' is not defined\r\n```\r\n\r\n* What are the versions of mypy and Python you are using? Do you see the same issue after installing mypy from Git master?\r\n\r\nReproduced with 0.750 and master (`69eb6fe8a8d7d091e2902b490ad6b43e6fed3d41`) under Python 3.7.\r\n\r\n* What are the mypy flags you are using? (For example --strict-optional)\r\n\r\nNo flags","author":{"url":"https://github.com/Phlogistique","@type":"Person","name":"Phlogistique"},"datePublished":"2020-04-21T08:17:57Z","url":"https://github.com/python/mypy/issues/8703"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:72ac33bf-9f72-8af2-4690-18120fa90b6e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EC20:2A4B31:244FEB:315213:6B002409 |
| html-safe-nonce | 669aaa80324b82b4ce85a2604c0adaa83922b1d501ddb504e7a57b11f11799cd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzIwOjJBNEIzMToyNDRGRUI6MzE1MjEzOjZCMDAyNDA5IiwidmlzaXRvcl9pZCI6IjgwMzkyOTM1NzQyNjI1NjM4NDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0c3795364c0c0a2651f7667bc47a02a1d5a113924e2af18cd4d3e10753a497e6 |
| hovercard-subject-tag | issue:603802653 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/8703/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5584068332acaa21b694e15f9e70ca7a331104af889ebdab344b9ebbe7caea0d/python/mypy/issues/8703 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5584068332acaa21b694e15f9e70ca7a331104af889ebdab344b9ebbe7caea0d/python/mypy/issues/8703 |
| og:image:alt | Note: if you are reporting a wrong signature of a function or a class in the standard library, then the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Phlogistique |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width