Title: False positive for overriding decorated method in an import cycle · Issue #5548 · python/mypy · GitHub
Open Graph Title: False positive for overriding decorated method in an import cycle · Issue #5548 · python/mypy
X Title: False positive for overriding decorated method in an import cycle · Issue #5548 · python/mypy
Description: Consider this test: [case testCyclicDecoratir] import b [file a.py] import b import c class A(b.B): @c.deco def meth(self) -> int: ... [file b.py] import a import c class B: @c.deco def meth(self) -> int: ... [file c.py] from typing impo...
Open Graph Description: Consider this test: [case testCyclicDecoratir] import b [file a.py] import b import c class A(b.B): @c.deco def meth(self) -> int: ... [file b.py] import a import c class B: @c.deco def meth(self) ...
X Description: Consider this test: [case testCyclicDecoratir] import b [file a.py] import b import c class A(b.B): @c.deco def meth(self) -> int: ... [file b.py] import a import c class B: @c.deco def meth(sel...
Opengraph URL: https://github.com/python/mypy/issues/5548
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"False positive for overriding decorated method in an import cycle","articleBody":"Consider this test:\r\n```\r\n[case testCyclicDecoratir]\r\nimport b\r\n[file a.py]\r\nimport b\r\nimport c\r\n\r\nclass A(b.B):\r\n @c.deco\r\n def meth(self) -> int: ...\r\n[file b.py]\r\nimport a\r\nimport c\r\n\r\nclass B:\r\n @c.deco\r\n def meth(self) -> int: ...\r\n[file c.py]\r\nfrom typing import TypeVar, Tuple, Callable\r\nT = TypeVar('T')\r\ndef deco(f: Callable[..., T]) -> Callable[..., Tuple[T, int]]: ...\r\n[out]\r\n```\r\nIt currently fails with\r\n```\r\ntmp/a.py:6: error: Signature of \"meth\" incompatible with supertype \"B\"\r\n```\r\nAlthough it is obviously compatible (it is actually identical). The error goes away if I change the order files are processed in the cycle (by importing `a` in main).\r\n\r\nThe reason is that non-trivial decorator needs to be type-checked to find the type in superclass _first_. A potential solution is to just defer the subclass method node.","author":{"url":"https://github.com/ilevkivskyi","@type":"Person","name":"ilevkivskyi"},"datePublished":"2018-08-31T14:51:30Z","url":"https://github.com/python/mypy/issues/5548"}
| 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:4876c15c-5587-6ce7-30a2-09e3a6abbc4f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B7A4:1756E4:10E60DF:16163EC:6B0007D5 |
| html-safe-nonce | 2fc3f47f786e5d0f315e2fc1a429aafa5b6841c73c3b8e92ff31ed6fec236b41 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCN0E0OjE3NTZFNDoxMEU2MERGOjE2MTYzRUM6NkIwMDA3RDUiLCJ2aXNpdG9yX2lkIjoiNjM0NzI2ODU0MzQ2MDkzNTYzNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5dbf98ae7c66539eaed40d72a2096482ce4036dbdd3dd6e017708437006d1f9a |
| hovercard-subject-tag | issue:356012014 |
| 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/5548/issue_layout |
| twitter:image | https://opengraph.githubassets.com/36e3a18b0ee397a23ac8d2a4b7bc982bd307b19782ff99fbc86a9cbfe289e737/python/mypy/issues/5548 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/36e3a18b0ee397a23ac8d2a4b7bc982bd307b19782ff99fbc86a9cbfe289e737/python/mypy/issues/5548 |
| og:image:alt | Consider this test: [case testCyclicDecoratir] import b [file a.py] import b import c class A(b.B): @c.deco def meth(self) -> int: ... [file b.py] import a import c class B: @c.deco def meth(self) ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ilevkivskyi |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| 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 | 16a11879678aaf97e2a42c33ee70830aa084fa37 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width