Title: specially crafted __rpow__ signature causes mypy to terminate with an "Internal Error" · Issue #5419 · python/mypy · GitHub
Open Graph Title: specially crafted __rpow__ signature causes mypy to terminate with an "Internal Error" · Issue #5419 · python/mypy
X Title: specially crafted __rpow__ signature causes mypy to terminate with an "Internal Error" · Issue #5419 · python/mypy
Description: Originally posted as Typeshed issue python/typeshed#2358 I discovered this bug mainly because I didn't know how __repr__ was supposed to work. This line (even if it's the only line in the python file): def __rpow__(self, x:int, mod:int =...
Open Graph Description: Originally posted as Typeshed issue python/typeshed#2358 I discovered this bug mainly because I didn't know how __repr__ was supposed to work. This line (even if it's the only line in the python fi...
X Description: Originally posted as Typeshed issue python/typeshed#2358 I discovered this bug mainly because I didn't know how __repr__ was supposed to work. This line (even if it's the only line in the p...
Opengraph URL: https://github.com/python/mypy/issues/5419
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"specially crafted __rpow__ signature causes mypy to terminate with an \"Internal Error\"","articleBody":"Originally posted as Typeshed issue https://github.com/python/typeshed/issues/2358\r\n\r\nI discovered this bug mainly because I didn't know how ``__repr__`` was supposed to work. \r\nThis line (even if it's the only line in the python file):\r\n```\r\ndef __rpow__(self, x:int, mod:int = None) -> int: ...\r\n```\r\n\r\nproduces this output:\r\n```\r\n./arbitrary_base_math_bug.py:5: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.620\r\nTraceback (most recent call last):\r\n File \"/home/peter/Documents/scratch_code/.venv/bin/mypy\", line 11, in \u003cmodule>\r\n sys.exit(console_entry())\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/__main__.py\", line 7, in console_entry\r\n main(None)\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/main.py\", line 91, in main\r\n res = type_check_only(sources, bin_dir, options, flush_errors, fscache) # noqa\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/main.py\", line 148, in type_check_only\r\n fscache=fscache)\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/build.py\", line 177, in build\r\n flush_errors, fscache)\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/build.py\", line 350, in _build\r\n graph = dispatch(sources, manager)\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/build.py\", line 2560, in dispatch\r\n process_graph(graph, manager)\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/build.py\", line 2853, in process_graph\r\n process_stale_scc(graph, scc, manager)\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/build.py\", line 2976, in process_stale_scc\r\n graph[id].type_check_first_pass()\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/build.py\", line 2151, in type_check_first_pass\r\n self.type_checker().check_first_pass()\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/checker.py\", line 253, in check_first_pass\r\n self.accept(d)\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/checker.py\", line 352, in accept\r\n stmt.accept(self)\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/nodes.py\", line 591, in accept\r\n return visitor.visit_func_def(self)\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/checker.py\", line 663, in visit_func_def\r\n self._visit_func_def(defn)\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/checker.py\", line 667, in _visit_func_def\r\n self.check_func_item(defn, name=defn.name())\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/checker.py\", line 729, in check_func_item\r\n self.check_func_def(defn, typ, name)\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/checker.py\", line 779, in check_func_def\r\n self.check_reverse_op_method(item, typ, name, defn)\r\n File \"/home/peter/Documents/scratch_code/.venv/lib/python3.7/site-packages/mypy/checker.py\", line 1006, in check_reverse_op_method\r\n assert len(reverse_type.arg_types) == 2\r\nAssertionError: \r\n./arbitrary_base_math_bug.py:5: : note: use --pdb to drop into pdb\r\n```\r\n\r\nthese very similar but slightly different lines will cause various warnings but will not cause the above problem:\r\n```\r\ndef __rpow__(self, x:int, mod:int = None): ...\r\ndef __rpow__(self, x:int, mod:int) -> int: ...\r\ndef __rpow__(x:int, mod:int = None) -> int: ...\r\ndef __rpow2__(self, x:int, mod:int = None) -> int: ...\r\n```\r\n","author":{"url":"https://github.com/gossrock","@type":"Person","name":"gossrock"},"datePublished":"2018-08-05T07:02:41Z","url":"https://github.com/python/mypy/issues/5419"}
| 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:c268e3a3-308c-1289-a59f-e79fdcedce44 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C8CE:D33AC:43C86D:5B2D4E:6B002C80 |
| html-safe-nonce | 6ebe7547e6b7721b7a003c138153371a0931609dc8e05c09a7d7b0956197e246 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOENFOkQzM0FDOjQzQzg2RDo1QjJENEU6NkIwMDJDODAiLCJ2aXNpdG9yX2lkIjoiNjQ0NzYxODc2NjQwOTgzNzY5NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9d17f7cf6ba4b7318cc4c58ca471650559cd308cbf843787b0e18bcd4d4c67a7 |
| hovercard-subject-tag | issue:347675005 |
| 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/5419/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a73d3a1701184f9bda926c186179fc6b21bd00296588174c2d6775a4af66e0d7/python/mypy/issues/5419 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a73d3a1701184f9bda926c186179fc6b21bd00296588174c2d6775a4af66e0d7/python/mypy/issues/5419 |
| og:image:alt | Originally posted as Typeshed issue python/typeshed#2358 I discovered this bug mainly because I didn't know how __repr__ was supposed to work. This line (even if it's the only line in the python fi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gossrock |
| 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