Title: [2.4 regression] Property getter body is not type-checked when the setter assigns to `self` · Issue #22229 · python/mypy · GitHub
Open Graph Title: [2.4 regression] Property getter body is not type-checked when the setter assigns to `self` · Issue #22229 · python/mypy
X Title: [2.4 regression] Property getter body is not type-checked when the setter assigns to `self` · Issue #22229 · python/mypy
Description: Bug Report Since 2.4.0, errors in the body of a property getter are no longer reported when the property's setter assigns an attribute on self. Same result when the attribute is declared in the class body (e.g. x = 0). To Reproduce class...
Open Graph Description: Bug Report Since 2.4.0, errors in the body of a property getter are no longer reported when the property's setter assigns an attribute on self. Same result when the attribute is declared in the cla...
X Description: Bug Report Since 2.4.0, errors in the body of a property getter are no longer reported when the property's setter assigns an attribute on self. Same result when the attribute is declared in the...
Opengraph URL: https://github.com/python/mypy/issues/22229
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[2.4 regression] Property getter body is not type-checked when the setter assigns to `self`","articleBody":"**Bug Report**\n\nSince 2.4.0, errors in the body of a property getter are no longer reported when the property's setter assigns an attribute on `self`.\nSame result when the attribute is declared in the class body (e.g. `x = 0`).\n\n\n**To Reproduce**\n\n```python\nclass A:\n @property\n def p(self) -> str:\n return 0\n\n @p.setter\n def p(self, value: int) -> None:\n self.x = value\n```\n\n\n**Expected Behavior**\n\nAs with mypy 2.3.0:\n\n```\nmain.py:4: error: Incompatible return value type (got \"int\", expected \"str\") [return-value]\nFound 1 error in 1 file (checked 1 source file)\n```\nSee [playground](https://mypy-play.net/?mypy=2.3.1&python=3.12&gist=4eef4041a004ed37caa2837ed805cdae)\n\n**Actual Behavior**\n\n```\nSuccess: no issues found in 1 source file\n```\nSee [playground](https://mypy-play.net/?gist=f85e10850283a9aa958f14122091314d)\n\n**Your Environment**\n\n\n- Mypy version used: 2.4.0, also master (45b9b1d03ed704ecc245b9636a3e63cbd8aa57a3)\n- Mypy command-line flags: none\n- Mypy configuration options from `mypy.ini` (and other config files): none\n- Python version used: 3.11 and 3.14\n\n\n\u003c!-- You can freely edit this text, please remove all the lines you believe are unnecessary. -->\n","author":{"url":"https://github.com/UnknownPlatypus","@type":"Person","name":"UnknownPlatypus"},"datePublished":"2026-10-19T16:43:32Z","url":"https://github.com/python/mypy/issues/22229"}
| 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:7c083c00-bae6-78e4-85e3-818c167b0960 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A9D4:3204C8:2CF9B9D:3B384F6:6B001C2D |
| html-safe-nonce | 4bd7e9aa46df353e251271ca1be28b777d5f422660cc2e2f264ab8796ec29188 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOUQ0OjMyMDRDODoyQ0Y5QjlEOjNCMzg0RjY6NkIwMDFDMkQiLCJ2aXNpdG9yX2lkIjoiOTA0Nzc5NTE2Mjg2MzkwMTc0MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 383a1cde38f36de80f9ff1cc8fae355c81df96d437b6c209970d79fd716bcb82 |
| hovercard-subject-tag | issue:5927798629 |
| 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/22229/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f2091abffa13def901177f2971a140e5afaacc500dd2350a70bb60f118c362a7/python/mypy/issues/22229 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f2091abffa13def901177f2971a140e5afaacc500dd2350a70bb60f118c362a7/python/mypy/issues/22229 |
| og:image:alt | Bug Report Since 2.4.0, errors in the body of a property getter are no longer reported when the property's setter assigns an attribute on self. Same result when the attribute is declared in the cla... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | UnknownPlatypus |
| 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