Title: Attribute access with untyped methods and --check-untyped-defs · Issue #5401 · python/mypy · GitHub
Open Graph Title: Attribute access with untyped methods and --check-untyped-defs · Issue #5401 · python/mypy
X Title: Attribute access with untyped methods and --check-untyped-defs · Issue #5401 · python/mypy
Description: Using mypy 0.620 and Python 3.7.0 I see strange behavior with descriptors in untyped methods. For example: from typing import Any class Getter: def __get__(self, obj: Any, _: Any = None) -> int: return 4 class Foo: x = Getter() def foo(s...
Open Graph Description: Using mypy 0.620 and Python 3.7.0 I see strange behavior with descriptors in untyped methods. For example: from typing import Any class Getter: def __get__(self, obj: Any, _: Any = None) -> int: re...
X Description: Using mypy 0.620 and Python 3.7.0 I see strange behavior with descriptors in untyped methods. For example: from typing import Any class Getter: def __get__(self, obj: Any, _: Any = None) -> int:...
Opengraph URL: https://github.com/python/mypy/issues/5401
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Attribute access with untyped methods and --check-untyped-defs","articleBody":"Using mypy 0.620 and Python 3.7.0 I see strange behavior with descriptors in untyped methods. For example:\r\n\r\n```python\r\nfrom typing import Any\r\n\r\nclass Getter:\r\n def __get__(self, obj: Any, _: Any = None) -> int:\r\n return 4\r\n\r\nclass Foo:\r\n x = Getter()\r\n\r\n def foo(self):\r\n reveal_type(self.x)\r\n\r\n def bar(self) -> None:\r\n reveal_type(self.x)\r\n```\r\n\r\nRunning with `mypy --check-untyped-defs` I get the following output:\r\n\r\n```\r\nfoo.py:11: error: Revealed type is 'Any'\r\nfoo.py:14: error: Revealed type is 'builtins.int'\r\n```\r\n\r\nIs this intended?","author":{"url":"https://github.com/srittau","@type":"Person","name":"srittau"},"datePublished":"2018-07-28T23:19:08Z","url":"https://github.com/python/mypy/issues/5401"}
| 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:15e5e99b-7d42-8402-067a-3a082bed80c1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DAEA:2DB972:3058638:4018AE4:6B002F32 |
| html-safe-nonce | 58461114433f20a0574c830e4c2afa524b17fd31d714d1e418f50deab03e2baf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQUVBOjJEQjk3MjozMDU4NjM4OjQwMThBRTQ6NkIwMDJGMzIiLCJ2aXNpdG9yX2lkIjoiNDAwOTk2NDE1NTc3NDcwOTU1NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | dc2eec8f60bc1a84556942684e40867ad75c0cf8c979e7eb88a7aa9c9bc18df8 |
| hovercard-subject-tag | issue:345486184 |
| 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/5401/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b267bd936b0c4592c757e68015ac02ee74059371c2b2dee90a566c1e54a1963f/python/mypy/issues/5401 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b267bd936b0c4592c757e68015ac02ee74059371c2b2dee90a566c1e54a1963f/python/mypy/issues/5401 |
| og:image:alt | Using mypy 0.620 and Python 3.7.0 I see strange behavior with descriptors in untyped methods. For example: from typing import Any class Getter: def __get__(self, obj: Any, _: Any = None) -> int: re... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | srittau |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width