Title: Presence of property in Protocol causes false positive in multiple inheritance scenario · Issue #16873 · python/mypy · GitHub
Open Graph Title: Presence of property in Protocol causes false positive in multiple inheritance scenario · Issue #16873 · python/mypy
X Title: Presence of property in Protocol causes false positive in multiple inheritance scenario · Issue #16873 · python/mypy
Description: Bug Report I'm getting a false positive from the following example from typing import Protocol from typing_extensions import Self class P(Protocol): # Removing the property makes the problem disappear @property def x(self) -> int: ... de...
Open Graph Description: Bug Report I'm getting a false positive from the following example from typing import Protocol from typing_extensions import Self class P(Protocol): # Removing the property makes the problem disapp...
X Description: Bug Report I'm getting a false positive from the following example from typing import Protocol from typing_extensions import Self class P(Protocol): # Removing the property makes the problem di...
Opengraph URL: https://github.com/python/mypy/issues/16873
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Presence of property in Protocol causes false positive in multiple inheritance scenario","articleBody":"**Bug Report**\r\n\r\nI'm getting a false positive from the following example\r\n```python\r\nfrom typing import Protocol\r\nfrom typing_extensions import Self\r\n\r\nclass P(Protocol):\r\n # Removing the property makes the problem disappear\r\n @property\r\n def x(self) -> int: ...\r\n\r\n def clone(self) -> Self: ...\r\n\r\nclass A:\r\n def clone(self) -> Self:\r\n return self\r\n\r\nclass B(A, P):\r\n @property\r\n def x(self) -> int:\r\n return 100\r\n```\r\n```\r\nmain.py:18: error: Definition of \"clone\" in base class \"A\" is incompatible with definition in base class \"P\" [misc]\r\n```\r\nObviously, `A.clone` does not actually clone the instance, but that is left out for clarity.\r\n\r\nThe false positive is not reported when I remove the property `x` from the protocol `P`.\r\n\r\n**To Reproduce**\r\n\r\nhttps://mypy-play.net/?mypy=latest&python=3.12&gist=fe15d8bc18aa7b61feb3e56fce615f47\r\n","author":{"url":"https://github.com/slanzmich","@type":"Person","name":"slanzmich"},"datePublished":"2024-02-05T08:13:30Z","url":"https://github.com/python/mypy/issues/16873"}
| 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:4aed37c5-ed55-3bab-556a-e36f2ae17881 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D96:18020:C3D3B:107231:6B001C8A |
| html-safe-nonce | 314664ab5e5a1bd8e9a5510c7fa81e883d7960d241ee945b9e28ea4d8e3759c2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDk2OjE4MDIwOkMzRDNCOjEwNzIzMTo2QjAwMUM4QSIsInZpc2l0b3JfaWQiOiIzOTI0MjEwMTQ2MjI5Njg5NzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1d1bc1c8d35c08767a02a96d433ddd6ea642123c23017c869d9886cac747cabf |
| hovercard-subject-tag | issue:2117925352 |
| 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/16873/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d4ec7280a0fbc78fdf1b326ce3d8b029b7199bfe8bfd7181b8dd5a9c41b5bc34/python/mypy/issues/16873 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d4ec7280a0fbc78fdf1b326ce3d8b029b7199bfe8bfd7181b8dd5a9c41b5bc34/python/mypy/issues/16873 |
| og:image:alt | Bug Report I'm getting a false positive from the following example from typing import Protocol from typing_extensions import Self class P(Protocol): # Removing the property makes the problem disapp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | slanzmich |
| 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