Title: Internal error with namedtuple+classmethod · Issue #3317 · python/mypy · GitHub
Open Graph Title: Internal error with namedtuple+classmethod · Issue #3317 · python/mypy
X Title: Internal error with namedtuple+classmethod · Issue #3317 · python/mypy
Description: Running off the latest master. from typing import * class Bar(NamedTuple): x: str @classmethod def new(cls, f: str) -> 'Bar': return Bar(x=f) [mypy] python_version = 3.6 check_untyped_defs = True disallow_untyped_calls = True follow_impo...
Open Graph Description: Running off the latest master. from typing import * class Bar(NamedTuple): x: str @classmethod def new(cls, f: str) -> 'Bar': return Bar(x=f) [mypy] python_version = 3.6 check_untyped_defs = True d...
X Description: Running off the latest master. from typing import * class Bar(NamedTuple): x: str @classmethod def new(cls, f: str) -> 'Bar': return Bar(x=f) [mypy] python_version = 3.6 check_untyped_de...
Opengraph URL: https://github.com/python/mypy/issues/3317
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Internal error with namedtuple+classmethod","articleBody":"Running off the latest master.\r\n\r\n```\r\nfrom typing import *\r\n\r\nclass Bar(NamedTuple):\r\n x: str\r\n\r\n @classmethod\r\n def new(cls, f: str) -> 'Bar':\r\n return Bar(x=f)\r\n```\r\n\r\n```\r\n[mypy]\r\npython_version = 3.6\r\n\r\ncheck_untyped_defs = True\r\ndisallow_untyped_calls = True\r\nfollow_imports = True\r\nincremental = True\r\nstrict_optional = True\r\nwarn_no_return = True\r\nwarn_return_any = True\r\nwarn_unused_ignores = True\r\n```\r\n\r\n```\r\nfoo.py:6: error: Invalid statement in NamedTuple definition; expected \"field_name: field_type\"\r\nfoo.py:6: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.510-dev-09e7b124b82dae1207d9eac6805b64a98290015c\r\n```\r\n\r\nThis might be fixed by #3081? I'm not sure how to install that to test\r\n\r\n\u003cdetails>\u003csummary>Stack trace is here\u003c/summary>\r\n\r\n```\r\nTraceback (most recent call last):\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/bin/mypy\", line 6, in \u003cmodule>\r\n main(__file__)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/main.py\", line 46, in main\r\n res = type_check_only(sources, bin_dir, options)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/main.py\", line 93, in type_check_only\r\n options=options)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/build.py\", line 188, in build\r\n graph = dispatch(sources, manager)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/build.py\", line 1595, in dispatch\r\n process_graph(graph, manager)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/build.py\", line 1838, in process_graph\r\n process_stale_scc(graph, scc, manager)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/build.py\", line 1937, in process_stale_scc\r\n graph[id].type_check_first_pass()\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/build.py\", line 1510, in type_check_first_pass\r\n self.type_checker.check_first_pass()\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/checker.py\", line 177, in check_first_pass\r\n self.accept(d)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/checker.py\", line 264, in accept\r\n stmt.accept(self)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/nodes.py\", line 749, in accept\r\n return visitor.visit_class_def(self)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/checker.py\", line 1080, in visit_class_def\r\n self.accept(defn.defs)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/checker.py\", line 264, in accept\r\n stmt.accept(self)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/nodes.py\", line 810, in accept\r\n return visitor.visit_block(self)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/checker.py\", line 1173, in visit_block\r\n self.accept(s)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/checker.py\", line 264, in accept\r\n stmt.accept(self)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/nodes.py\", line 631, in accept\r\n return visitor.visit_decorator(self)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/checker.py\", line 2213, in visit_decorator\r\n e.func.accept(self)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/nodes.py\", line 564, in accept\r\n return visitor.visit_func_def(self)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/checker.py\", line 513, in visit_func_def\r\n self.check_method_override(defn)\r\n File \"/Users/daenyth/Curata/observer/.tox/mypy/lib/python3.6/site-packages/mypy/checker.py\", line 945, in check_method_override\r\n for base in defn.info.mro[1:]:\r\nTypeError: 'NoneType' object is not subscriptable\r\n```\r\n\r\n\u003c/details>","author":{"url":"https://github.com/Daenyth","@type":"Person","name":"Daenyth"},"datePublished":"2017-05-04T12:04:01Z","url":"https://github.com/python/mypy/issues/3317"}
| 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:73d8e9eb-a281-5969-d81a-570b3c74d254 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A068:2E9DBB:21FE8AF:2E654EB:6B002A7F |
| html-safe-nonce | 4820dbc70131cd23a3c674332f421ce5e52684108a9836b070937703ab9e92db |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMDY4OjJFOURCQjoyMUZFOEFGOjJFNjU0RUI6NkIwMDJBN0YiLCJ2aXNpdG9yX2lkIjoiNTMzMTA2NTYzNjExNjI0NTExOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 35e1b099eba962cded4e827b928fc30b47bbee62d81c2b6893c9ca36944f857e |
| hovercard-subject-tag | issue:226259032 |
| 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/3317/issue_layout |
| twitter:image | https://opengraph.githubassets.com/72e292c49b560f42db64b30e24650c276124204e7202d363a40ff4a48733c0b7/python/mypy/issues/3317 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/72e292c49b560f42db64b30e24650c276124204e7202d363a40ff4a48733c0b7/python/mypy/issues/3317 |
| og:image:alt | Running off the latest master. from typing import * class Bar(NamedTuple): x: str @classmethod def new(cls, f: str) -> 'Bar': return Bar(x=f) [mypy] python_version = 3.6 check_untyped_defs = True d... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Daenyth |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width