Title: Incorrect errors for fstrings + generators · Issue #3385 · python/mypy · GitHub
Open Graph Title: Incorrect errors for fstrings + generators · Issue #3385 · python/mypy
X Title: Incorrect errors for fstrings + generators · Issue #3385 · python/mypy
Description: mypy version: 0.511 python version: 3.6.1 Given this valid program: from typing import Iterator def stringify(it: Iterator[int]) -> Iterator[str]: return (f"{x}" for x in it) def stringify2(it: Iterator[int]) -> Iterator[str]: for x in i...
Open Graph Description: mypy version: 0.511 python version: 3.6.1 Given this valid program: from typing import Iterator def stringify(it: Iterator[int]) -> Iterator[str]: return (f"{x}" for x in it) def stringify2(it: Ite...
X Description: mypy version: 0.511 python version: 3.6.1 Given this valid program: from typing import Iterator def stringify(it: Iterator[int]) -> Iterator[str]: return (f"{x}" for x in it) def strin...
Opengraph URL: https://github.com/python/mypy/issues/3385
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incorrect errors for fstrings + generators","articleBody":"mypy version: 0.511\r\npython version: 3.6.1\r\n\r\nGiven this valid program:\r\n\r\n``` py\r\nfrom typing import Iterator\r\n\r\ndef stringify(it: Iterator[int]) -> Iterator[str]:\r\n return (f\"{x}\" for x in it)\r\n\r\ndef stringify2(it: Iterator[int]) -> Iterator[str]:\r\n for x in it:\r\n yield f\"{x}\"\r\n\r\ndef stringify3(it: Iterator[int]) -> Iterator[str]:\r\n return (str(x) for x in it)\r\n\r\ndef stringify4(it: Iterator[int]) -> Iterator[str]:\r\n for x in it:\r\n yield str(x)\r\n```\r\n\r\nI get errors for the first two variations:\r\n\r\n```\r\nfoo.py:4: error: Generator has incompatible item type \"int\"\r\nfoo.py:8: error: Incompatible types in yield (actual type \"int\", expected type \"str\")\r\n```\r\n\r\nIt seems that mypy doesn't recognize that fstrings are produce a `str`. Interestingly, the yield error didn't show up in my old mypy version 0.501.","author":{"url":"https://github.com/ns-cweber","@type":"Person","name":"ns-cweber"},"datePublished":"2017-05-19T16:09:18Z","url":"https://github.com/python/mypy/issues/3385"}
| 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:fd0e77ce-1a73-1f62-c6ba-d4e75a5de481 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E2E4:31B434:173C4A9:1E7A7A1:6B00158D |
| html-safe-nonce | 6c5f2b2c1d94204b36f66a70da82b5d282c95fc3f8462d1e81ff2931d1939c16 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMkU0OjMxQjQzNDoxNzNDNEE5OjFFN0E3QTE6NkIwMDE1OEQiLCJ2aXNpdG9yX2lkIjoiNDYyMjM4Mzc1MTk0MTM3OTk3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 86856b40f3e5770ff631e0ad6eaa6981f7c7dbce3aa5718fbab4fbbe093d465d |
| hovercard-subject-tag | issue:230020777 |
| 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/3385/issue_layout |
| twitter:image | https://opengraph.githubassets.com/be38554459ce4adeac603f5e4a1025b53fde778eeb2d6733530a1b96ac68bf3d/python/mypy/issues/3385 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/be38554459ce4adeac603f5e4a1025b53fde778eeb2d6733530a1b96ac68bf3d/python/mypy/issues/3385 |
| og:image:alt | mypy version: 0.511 python version: 3.6.1 Given this valid program: from typing import Iterator def stringify(it: Iterator[int]) -> Iterator[str]: return (f"{x}" for x in it) def stringify2(it: Ite... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ns-cweber |
| hostname | github.com |
| expected-hostname | github.com |
| None | a2dd2291b1b13cc9c06f27ec92fa3dbaf34116fc24c9347b8539db61884c59f4 |
| 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 | 70121d4e855ee0bb7b75cf15d061d91f8863c0f8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width