Title: Uninformative message with fast-parser · Issue #1633 · python/mypy · GitHub
Open Graph Title: Uninformative message with fast-parser · Issue #1633 · python/mypy
X Title: Uninformative message with fast-parser · Issue #1633 · python/mypy
Description: To reproduce the bug, see https://github.com/medullaskyline/tuplebug Running the test case: virtualenv testcase -p `which python3` source testcase/bin/activate pip install -r requirements.txt Annotating a tuple incorrectly will result in...
Open Graph Description: To reproduce the bug, see https://github.com/medullaskyline/tuplebug Running the test case: virtualenv testcase -p `which python3` source testcase/bin/activate pip install -r requirements.txt Annot...
X Description: To reproduce the bug, see https://github.com/medullaskyline/tuplebug Running the test case: virtualenv testcase -p `which python3` source testcase/bin/activate pip install -r requirements.txt Annot...
Opengraph URL: https://github.com/python/mypy/issues/1633
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Uninformative message with fast-parser","articleBody":"To reproduce the bug, see https://github.com/medullaskyline/tuplebug\n\nRunning the test case:\n\n```\nvirtualenv testcase -p `which python3`\nsource testcase/bin/activate\npip install -r requirements.txt\n```\n\nAnnotating a tuple incorrectly will result in an uninformative traceback when running mypy with the `--fast-parser` flag.\n\nThis is the file I'm parsing: https://github.com/medullaskyline/tuplebug/blob/master/testcase.py\n\n```\n$ mypy --fast-parser --silent-imports --py2 --check-untyped-defs --disallow-untyped-defs testcase.py\nTraceback (most recent call last):\n File \"/srv/zulip-py3-venv/bin/mypy\", line 6, in \u003cmodule>\n main(__file__)\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/main.py\", line 54, in main\n res = type_check_only(sources, bin_dir, options)\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/main.py\", line 102, in type_check_only\n python_path=options.python_path)\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/build.py\", line 209, in build\n dispatch(sources, manager)\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/build.py\", line 1319, in dispatch\n graph = load_graph(sources, manager)\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/build.py\", line 1334, in load_graph\n st = State(id=bs.module, path=bs.path, source=bs.text, manager=manager)\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/build.py\", line 1106, in __init__\n self.parse_file()\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/build.py\", line 1217, in parse_file\n self.tree = manager.parse_file(self.id, self.xpath, source)\n File \"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/contextlib.py\", line 77, in __exit__\n self.gen.throw(type, value, traceback)\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/build.py\", line 1171, in wrap_context\n yield\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/build.py\", line 1217, in parse_file\n self.tree = manager.parse_file(self.id, self.xpath, source)\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/build.py\", line 449, in parse_file\n fast_parser=FAST_PARSER in self.flags)\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/parse.py\", line 88, in parse\n custom_typing_module=custom_typing_module)\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/fastparse.py\", line 69, in parse\n ).visit(ast)\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/typed_ast/ast35.py\", line 252, in visit\n return visitor(node)\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/fastparse.py\", line 221, in visit_Module\n body = self.fix_function_overloads(self.visit_list(mod.body))\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/fastparse.py\", line 122, in visit_list\n return [self.visit(e) for e in l]\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/fastparse.py\", line 122, in \u003clistcomp>\n return [self.visit(e) for e in l]\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/typed_ast/ast35.py\", line 252, in visit\n return visitor(node)\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/fastparse.py\", line 90, in wrapper\n node = f(self, ast)\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/mypy/fastparse.py\", line 242, in visit_FunctionDef\n func_type_ast = ast35.parse(n.type_comment, '\u003cfunc_type>', 'func_type')\n File \"/srv/zulip-py3-venv/lib/python3.5/site-packages/typed_ast/ast35.py\", line 42, in parse\n return _ast35._parse(source, filename, mode)\nSyntaxError: invalid syntax (\u003cfunc_type>, line 1)\n\n*** INTERNAL ERROR ***\n\ntestcase.py: error: Internal error -- please report a bug at https://github.com/python/mypy/issues\n\nNOTE: you can use \"mypy --pdb ...\" to drop into the debugger when this happens.\n```\n\nThis should be changed to the informative message that results when the `--fast-parser` flag is omitted\n\n```\n$ mypy --silent-imports --py2 --check-untyped-defs --disallow-untyped-defs testcase.py\ntestcase.py: note: In function \"return_a_tuple\":\ntestcase.py:3: error: Parse error before ,\n```\n","author":{"url":"https://github.com/medullaskyline","@type":"Person","name":"medullaskyline"},"datePublished":"2016-06-03T19:33:31Z","url":"https://github.com/python/mypy/issues/1633"}
| 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:a2121cb8-772b-c2ad-ae9e-79afde4e020e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A690:23FDF9:29A2591:390A5E8:6B0055E1 |
| html-safe-nonce | 9e4a502dada21d146828c204eda13ac6a31277abf53acd76531bd6747bb86baa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjkwOjIzRkRGOToyOUEyNTkxOjM5MEE1RTg6NkIwMDU1RTEiLCJ2aXNpdG9yX2lkIjoiNjQxODE1Mzg3MzQyMDA4MDYwOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3b81ede15d76bdceacfadcbba3751dc0a0db368043f1c4937be196d5aecd2dcb |
| hovercard-subject-tag | issue:158438735 |
| 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/1633/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fa7af9a159fbf884fc6f8f1e8b0daa67a8f566a9b5507b72bbd630452222d6d8/python/mypy/issues/1633 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fa7af9a159fbf884fc6f8f1e8b0daa67a8f566a9b5507b72bbd630452222d6d8/python/mypy/issues/1633 |
| og:image:alt | To reproduce the bug, see https://github.com/medullaskyline/tuplebug Running the test case: virtualenv testcase -p `which python3` source testcase/bin/activate pip install -r requirements.txt Annot... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | medullaskyline |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| 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 | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width