Title: Crash with --linecoverage-report on comment after decorator use · Issue #4563 · python/mypy · GitHub
Open Graph Title: Crash with --linecoverage-report on comment after decorator use · Issue #4563 · python/mypy
X Title: Crash with --linecoverage-report on comment after decorator use · Issue #4563 · python/mypy
Description: We ran into a mypy crash in Zulip, which was fixed with the following patch: -@register.filter(name='render_markdown_path', is_safe=True) # Much of the time, render_markdown_path is called with hashable # arguments, so this decorator is ...
Open Graph Description: We ran into a mypy crash in Zulip, which was fixed with the following patch: -@register.filter(name='render_markdown_path', is_safe=True) # Much of the time, render_markdown_path is called with has...
X Description: We ran into a mypy crash in Zulip, which was fixed with the following patch: -@register.filter(name='render_markdown_path', is_safe=True) # Much of the time, render_markdown_path is called ...
Opengraph URL: https://github.com/python/mypy/issues/4563
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Crash with --linecoverage-report on comment after decorator use","articleBody":"We ran into a mypy crash in Zulip, which was [fixed with](https://github.com/zulip/zulip/commit/7925e258a) the following patch:\r\n```\r\n\r\n-@register.filter(name='render_markdown_path', is_safe=True)\r\n # Much of the time, render_markdown_path is called with hashable\r\n # arguments, so this decorator is effective even though it only caches\r\n # the results when called if none of the arguments are unhashable.\r\n @ignore_unhashable_lru_cache(512)\r\n+@register.filter(name='render_markdown_path', is_safe=True)\r\n def render_markdown_path(markdown_file_path, context=None):\r\n # type: (str, Optional[Dict[Any, Any]]) -> str\r\n \"\"\"Given a path to a markdown file, return the rendered html.\r\n```\r\n\r\nThe traceback (with long source paths abbreviated):\r\n```\r\nzerver/templatetags/app_filters.py: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.560\r\nTraceback (most recent call last):\r\n File \"/srv/zulip-py3-venv/bin/mypy\", line 11, in \u003cmodule>\r\n sys.exit(console_entry())\r\n File \".../site-packages/mypy/__main__.py\", line 7, in console_entry\r\n main(None)\r\n File \".../site-packages/mypy/main.py\", line 66, in main\r\n res = type_check_only(sources, bin_dir, options)\r\n File \".../site-packages/mypy/main.py\", line 119, in type_check_only\r\n options=options)\r\n File \".../site-packages/mypy/build.py\", line 218, in build\r\n graph = dispatch(sources, manager)\r\n File \".../site-packages/mypy/build.py\", line 1997, in dispatch\r\n process_graph(graph, manager)\r\n File \".../site-packages/mypy/build.py\", line 2299, in process_graph\r\n process_stale_scc(graph, scc, manager)\r\n File \".../site-packages/mypy/build.py\", line 2486, in process_stale_scc\r\n graph[id].finish_passes()\r\n File \".../site-packages/mypy/build.py\", line 1912, in finish_passes\r\n manager.report_file(self.tree, self.type_map(), self.options)\r\n File \"/usr/lib/python3.4/contextlib.py\", line 77, in __exit__\r\n self.gen.throw(type, value, traceback)\r\n File \".../site-packages/mypy/build.py\", line 1675, in wrap_context\r\n yield\r\n File \".../site-packages/mypy/build.py\", line 1912, in finish_passes\r\n manager.report_file(self.tree, self.type_map(), self.options)\r\n File \".../site-packages/mypy/build.py\", line 681, in report_file\r\n self.reports.file(file, type_map, options)\r\n File \".../site-packages/mypy/report.py\", line 73, in file\r\n reporter.on_file(tree, type_map, options)\r\n File \".../site-packages/mypy/report.py\", line 347, in on_file\r\n tree.accept(coverage_visitor)\r\n File \".../site-packages/mypy/nodes.py\", line 228, in accept\r\n return visitor.visit_mypy_file(self)\r\n File \".../site-packages/mypy/traverser.py\", line 30, in visit_mypy_file\r\n d.accept(self)\r\n File \".../site-packages/mypy/nodes.py\", line 573, in accept\r\n return visitor.visit_decorator(self)\r\n File \".../site-packages/mypy/traverser.py\", line 64, in visit_decorator\r\n o.func.accept(self)\r\n File \".../site-packages/mypy/nodes.py\", line 497, in accept\r\n return visitor.visit_func_def(self)\r\n File \".../site-packages/mypy/report.py\", line 317, in visit_func_def\r\n assert start_indent is not None and start_indent > old_indent\r\nAssertionError:\r\nzerver/templatetags/app_filters.py: : note: use --pdb to drop into pdb\r\n```\r\n\r\nSo it looks like we got confused by the line after the decorator being neither a definition nor the next decorator, but instead a comment.\r\n","author":{"url":"https://github.com/gnprice","@type":"Person","name":"gnprice"},"datePublished":"2018-02-10T03:53:15Z","url":"https://github.com/python/mypy/issues/4563"}
| 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:e9d17e30-4ae4-4172-598a-002dfee49728 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8DBE:182C25:C146D:106C13:6B001CA6 |
| html-safe-nonce | 96ab83c2bab0d258f07bccbbe8b7cb7539735bdc8866fb0ae9ba66bbd6fb031e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4REJFOjE4MkMyNTpDMTQ2RDoxMDZDMTM6NkIwMDFDQTYiLCJ2aXNpdG9yX2lkIjoiMzA3MzUxMTEyODg5NTA2OTM1MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3d201e1e792c462f5528e7b8851676a6b542ff055edbf87aaa48c32e98a94735 |
| hovercard-subject-tag | issue:296070578 |
| 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/4563/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fa0758e00b35cd7c7526a6014723bdcbad84a6439c038c6b2383fa11af165064/python/mypy/issues/4563 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fa0758e00b35cd7c7526a6014723bdcbad84a6439c038c6b2383fa11af165064/python/mypy/issues/4563 |
| og:image:alt | We ran into a mypy crash in Zulip, which was fixed with the following patch: -@register.filter(name='render_markdown_path', is_safe=True) # Much of the time, render_markdown_path is called with has... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gnprice |
| 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