Title: isinstance + generator results in unexpected error · Issue #1044 · python/mypy · GitHub
Open Graph Title: isinstance + generator results in unexpected error · Issue #1044 · python/mypy
X Title: isinstance + generator results in unexpected error · Issue #1044 · python/mypy
Description: This code doesn't generate errors: class A: y = False a = None # type: object (a.y for a in [A()]) However, this generates (just added isinstance): class A: y = False a = None # type: object if isinstance(a, int): pass # only difference ...
Open Graph Description: This code doesn't generate errors: class A: y = False a = None # type: object (a.y for a in [A()]) However, this generates (just added isinstance): class A: y = False a = None # type: object if isi...
X Description: This code doesn't generate errors: class A: y = False a = None # type: object (a.y for a in [A()]) However, this generates (just added isinstance): class A: y = False a = None # type: object if...
Opengraph URL: https://github.com/python/mypy/issues/1044
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"isinstance + generator results in unexpected error","articleBody":"This code doesn't generate errors:\n\n```\nclass A:\n y = False\na = None # type: object\n(a.y for a in [A()])\n```\n\nHowever, this generates (just added `isinstance`):\n\n```\nclass A:\n y = False\na = None # type: object\nif isinstance(a, int): pass # only difference\n(a.y for a in [A()])\n```\n\nOutput is like this:\n\n```\nprogram.py:7: error: \"object\" has no attribute \"y\"\n```\n\nThe latter program shouldn't generate any error. There seems to be some weird interaction between `isinstance` and generator scoping.\n","author":{"url":"https://github.com/JukkaL","@type":"Person","name":"JukkaL"},"datePublished":"2015-12-04T04:55:13Z","url":"https://github.com/python/mypy/issues/1044"}
| 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:5855b1f1-cd2a-8d8c-a0a1-2123575b8ea8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8676:4D1C6:28C792D:37A2002:6B004C91 |
| html-safe-nonce | e5cea1f51ee9000afb7d8cd3b268742be716daefab01ac6e597b7b27ef8c53ad |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Njc2OjREMUM2OjI4Qzc5MkQ6MzdBMjAwMjo2QjAwNEM5MSIsInZpc2l0b3JfaWQiOiIyNDQ4Mjc0NTExNzc1MTU3MzkzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c43e02b589ab99853d27050d2e52ee14df83e0a2a85d186a9cf9a0a7b4ef626d |
| hovercard-subject-tag | issue:120333339 |
| 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/1044/issue_layout |
| twitter:image | https://opengraph.githubassets.com/027bdc415e65a75471e8222212b9dd8d19f50535e38bde0f7cce322185fc012e/python/mypy/issues/1044 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/027bdc415e65a75471e8222212b9dd8d19f50535e38bde0f7cce322185fc012e/python/mypy/issues/1044 |
| og:image:alt | This code doesn't generate errors: class A: y = False a = None # type: object (a.y for a in [A()]) However, this generates (just added isinstance): class A: y = False a = None # type: object if isi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JukkaL |
| hostname | github.com |
| expected-hostname | github.com |
| None | f9517bf360d46638a1e5e7daee7158842fe5ef43c9000afa0e127564a7c2f39b |
| 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 | b27c5dde30676028abd5c5fc53ce5c9b625f8281 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width