Title: `builtins.sum`: Spurious error for operands having `__add__` defined using `partialmethod` · Issue #7739 · python/typeshed · GitHub
Open Graph Title: `builtins.sum`: Spurious error for operands having `__add__` defined using `partialmethod` · Issue #7739 · python/typeshed
X Title: `builtins.sum`: Spurious error for operands having `__add__` defined using `partialmethod` · Issue #7739 · python/typeshed
Description: Here's a minimal reproducer: from __future__ import annotations from functools import partialmethod class A: def my_add(self, other: A, reverse: bool) -> A: return self __add__ = partialmethod(my_add, reverse=False) a = A() aa = A() aaa ...
Open Graph Description: Here's a minimal reproducer: from __future__ import annotations from functools import partialmethod class A: def my_add(self, other: A, reverse: bool) -> A: return self __add__ = partialmethod(my_a...
X Description: Here's a minimal reproducer: from __future__ import annotations from functools import partialmethod class A: def my_add(self, other: A, reverse: bool) -> A: return self __add__ = partialmeth...
Opengraph URL: https://github.com/python/typeshed/issues/7739
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`builtins.sum`: Spurious error for operands having `__add__` defined using `partialmethod`","articleBody":"Here's a minimal reproducer:\r\n```python\r\nfrom __future__ import annotations\r\nfrom functools import partialmethod\r\n\r\nclass A:\r\n def my_add(self, other: A, reverse: bool) -> A:\r\n return self\r\n\r\n __add__ = partialmethod(my_add, reverse=False)\r\n\r\na = A()\r\naa = A()\r\naaa = A()\r\nresult = sum([aa, a], start=aaa)\r\n```\r\nAnd the commands to reproduce it:\r\n```bash\r\n$ mypy --version\r\nmypy 0.950 (compiled: yes)\r\n\r\n$ mypy --show-error-codes --strict mypy_bug_report.py \r\nmypy_bug_report.py:15: error: No overload variant of \"sum\" matches argument types \"List[A]\", \"A\" [call-overload]\r\nmypy_bug_report.py:15: note: Possible overload variants:\r\nmypy_bug_report.py:15: note: def [_SumT \u003c: _SupportsSum] sum(Iterable[_SumT]) -> Union[_SumT, Literal[0]]\r\nmypy_bug_report.py:15: note: def [_SumT \u003c: _SupportsSum, _SumS \u003c: _SupportsSum] sum(Iterable[_SumT], start: _SumS) -> Union[_SumT, _SumS]\r\nFound 1 error in 1 file (checked 1 source file)\r\n```\r\n\r\nRelated https://github.com/python/typeshed/issues/7735, https://github.com/python/typeshed/pull/7578","author":{"url":"https://github.com/kaushikcfd","@type":"Person","name":"kaushikcfd"},"datePublished":"2022-04-29T00:38:06Z","url":"https://github.com/python/typeshed/issues/7739"}
| 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:078eff2a-425e-0f2c-9925-cb68c9b7dd19 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E726:44D65:C93D1E:10DC659:6B0052F9 |
| html-safe-nonce | 3c7bcdbd42d349a1c563aa29545707aaa5dc705f35208e48960750a2ed5db934 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzI2OjQ0RDY1OkM5M0QxRToxMERDNjU5OjZCMDA1MkY5IiwidmlzaXRvcl9pZCI6IjM2NzYyODkxMTcyMTEwODc2MDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cc617b9cd56dc86af9f1fb0dd895fd08ef5b6828b83cc8648ff490a119813e87 |
| hovercard-subject-tag | issue:1219504618 |
| 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/typeshed/7739/issue_layout |
| twitter:image | https://opengraph.githubassets.com/40c05a76d63495fc3c5864975e491202f9028f95edefb66d49b48d870e8dc20e/python/typeshed/issues/7739 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/40c05a76d63495fc3c5864975e491202f9028f95edefb66d49b48d870e8dc20e/python/typeshed/issues/7739 |
| og:image:alt | Here's a minimal reproducer: from __future__ import annotations from functools import partialmethod class A: def my_add(self, other: A, reverse: bool) -> A: return self __add__ = partialmethod(my_a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kaushikcfd |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| 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 | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width