Title: Signature incompatible with supertype when using overload since updating from 1.1.1 to 1.2.0 · Issue #15041 · python/mypy · GitHub
Open Graph Title: Signature incompatible with supertype when using overload since updating from 1.1.1 to 1.2.0 · Issue #15041 · python/mypy
X Title: Signature incompatible with supertype when using overload since updating from 1.1.1 to 1.2.0 · Issue #15041 · python/mypy
Description: Bug Report Since updating from 1.1.1 to 1.2.0 the following code does not pass anymore. Reading the change log I am assuming this might be related to #14882. To Reproduce #!/usr/bin/env python3 import typing if typing.TYPE_CHECKING: from...
Open Graph Description: Bug Report Since updating from 1.1.1 to 1.2.0 the following code does not pass anymore. Reading the change log I am assuming this might be related to #14882. To Reproduce #!/usr/bin/env python3 imp...
X Description: Bug Report Since updating from 1.1.1 to 1.2.0 the following code does not pass anymore. Reading the change log I am assuming this might be related to #14882. To Reproduce #!/usr/bin/env python3 imp...
Opengraph URL: https://github.com/python/mypy/issues/15041
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Signature incompatible with supertype when using overload since updating from 1.1.1 to 1.2.0","articleBody":"**Bug Report**\r\n\r\nSince updating from 1.1.1 to 1.2.0 the following code does not pass anymore.\r\n\r\nReading the [change log](https://mypy-lang.blogspot.com/2023/04/mypy-12-released.html) I am assuming this might be related to https://github.com/python/mypy/pull/14882.\r\n\r\n\r\n**To Reproduce**\r\n\r\n```python\r\n#!/usr/bin/env python3\r\n\r\nimport typing\r\nif typing.TYPE_CHECKING:\r\n\tfrom typing_extensions import Self\r\n\r\nT_co = typing.TypeVar('T_co', covariant=True)\r\n\r\n\r\nclass Config(typing.Generic[T_co]):\r\n\r\n\tdef __init__(self, value: T_co) -> None:\r\n\t\tself.value = value\r\n\r\n\t@typing.overload\r\n\tdef __get__(self, instance: None, owner: typing.Any = None) -> 'Self':\r\n\t\tpass\r\n\r\n\t@typing.overload\r\n\tdef __get__(self, instance: typing.Any, owner: typing.Any = None) -> T_co:\r\n\t\tpass\r\n\r\n\tdef __get__(self, instance: typing.Any, owner: typing.Any = None) -> 'T_co|Self':\r\n\t\tif instance is None:\r\n\t\t\treturn self\r\n\r\n\t\treturn self.value\r\n\r\nclass MultiConfig(Config[T_co]):\r\n\r\n\tdef __init__(self, val: T_co) -> None:\r\n\t\tsuper().__init__(val)\r\n\t\tself.values: 'dict[object, T_co]' = {}\r\n\r\n\t@typing.overload\r\n\tdef __get__(self, instance: None, owner: typing.Any = None) -> 'Self':\r\n\t\tpass\r\n\r\n\t@typing.overload\r\n\tdef __get__(self, instance: typing.Any, owner: typing.Any = None) -> T_co:\r\n\t\tpass\r\n\r\n\tdef __get__(self, instance: typing.Any, owner: typing.Any = None) -> 'T_co|Self':\r\n\t\tif instance is None:\r\n\t\t\treturn self\r\n\r\n\t\treturn self.values.get(instance.config_id, self.value)\r\n```\r\n\r\n**Expected Behavior**\r\n\r\nThis code should pass, as it did in 1.1.1.\r\n\r\n\r\n**Actual Behavior**\r\n\r\n```\r\n$ mypy --strict mwe.py\r\nmwe.py:35: error: Signature of \"__get__\" incompatible with supertype \"Config\" [override]\r\nmwe.py:35: note: Superclass:\r\nmwe.py:35: note: @overload\r\nmwe.py:35: note: def __get__(self, instance: Any, owner: Any = ...) -> T_co\r\nmwe.py:35: note: Subclass:\r\nmwe.py:35: note: @overload\r\nmwe.py:35: note: def __get__(self, instance: None, owner: Any = ...) -> MultiConfig[T_co]\r\nmwe.py:35: note: @overload\r\nmwe.py:35: note: def __get__(self, instance: Any, owner: Any = ...) -> T_co\r\nFound 1 error in 1 file (checked 1 source file)\r\n```\r\n\r\n\r\n**Your Environment**\r\n\r\n- Mypy version used: 1.2.0\r\n- Mypy command-line flags: `--strict` (but it does not make a difference)\r\n- Mypy configuration options from `mypy.ini` (and other config files): none\r\n- Python version used: Python 3.10.10","author":{"url":"https://github.com/erzoe","@type":"Person","name":"erzoe"},"datePublished":"2023-04-12T06:46:55Z","url":"https://github.com/python/mypy/issues/15041"}
| 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:33433fa7-43f7-f378-2d0b-8472381507bd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A77A:14B836:262F29:33B205:6B002414 |
| html-safe-nonce | 034af696a2330f239b7e06e98613ec10605b73fd6be8ac4d524073205bb62fd0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzdBOjE0QjgzNjoyNjJGMjk6MzNCMjA1OjZCMDAyNDE0IiwidmlzaXRvcl9pZCI6IjMxNzU0MjU0NzU4NTM5NTIwMjAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 562314f0912282cafb0f1e62dc9162947dfbcc46c6ada8047dabc18e65c78eba |
| hovercard-subject-tag | issue:1663943508 |
| 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/15041/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b7e3068e43fbb2a876e4888b604e644351a9ded6e19cffc3c59c47d06aebd423/python/mypy/issues/15041 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b7e3068e43fbb2a876e4888b604e644351a9ded6e19cffc3c59c47d06aebd423/python/mypy/issues/15041 |
| og:image:alt | Bug Report Since updating from 1.1.1 to 1.2.0 the following code does not pass anymore. Reading the change log I am assuming this might be related to #14882. To Reproduce #!/usr/bin/env python3 imp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | erzoe |
| 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