Title: misleading SyntaxError (f-string and type alias related) · Issue #109114 · python/cpython · GitHub
Open Graph Title: misleading SyntaxError (f-string and type alias related) · Issue #109114 · python/cpython
X Title: misleading SyntaxError (f-string and type alias related) · Issue #109114 · python/cpython
Description: Bug report Bug description: The following code produces a misleading syntax error. lambda name_3=f'{name_4}': {name_3} type {}[name_4] = {} output (Python 3.12.0rc2+): File "/home/frank/projects/pysource-codegen/bug.py", line 1 lambda na...
Open Graph Description: Bug report Bug description: The following code produces a misleading syntax error. lambda name_3=f'{name_4}': {name_3} type {}[name_4] = {} output (Python 3.12.0rc2+): File "/home/frank/projects/py...
X Description: Bug report Bug description: The following code produces a misleading syntax error. lambda name_3=f'{name_4}': {name_3} type {}[name_4] = {} output (Python 3.12.0rc2+): File "/home/fran...
Opengraph URL: https://github.com/python/cpython/issues/109114
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"misleading SyntaxError (f-string and type alias related)","articleBody":"# Bug report\n\n### Bug description:\n\nThe following code produces a misleading syntax error.\n\n```python\nlambda name_3=f'{name_4}': {name_3}\n\ntype {}[name_4] = {}\n\n```\n\noutput (Python 3.12.0rc2+):\n```python\n File \"/home/frank/projects/pysource-codegen/bug.py\", line 1\n lambda name_3=f'{name_4}': {name_3}\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\nSyntaxError: f-string: lambda expressions are not allowed without parentheses\n```\nThe first line should be valid python syntax and I would expect to get an syntax error for the wrong type alias name.\n\nside note:\nThis is generated code. I found this issue during my work for the python 3.12 support for pysource-codegen.\n\n### CPython versions tested on:\n\n3.12\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-109121\n* gh-109155\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/15r10nk","@type":"Person","name":"15r10nk"},"datePublished":"2023-09-07T21:06:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/109114/cpython/issues/109114"}
| 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:f518bf42-baff-9a5e-486d-f06a3106e586 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B894:1FFF76:199AAC:22F273:6A5FEA6E |
| html-safe-nonce | a8b1ad9b9e7806a39a8060cb39159dbe438da71f7ebfe93b5b5fb03e21e74eac |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODk0OjFGRkY3NjoxOTlBQUM6MjJGMjczOjZBNUZFQTZFIiwidmlzaXRvcl9pZCI6IjEwOTg4MDQzNjAxMTYxNjkzMjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e26f9f6f2b40e7d27bb2567c1476c1cc663dd0d47f539253bf98823712048fbc |
| hovercard-subject-tag | issue:1886563899 |
| 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/cpython/109114/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2de02b965c24663368266b7173910ad2b999b4309dd08f6ad897b7695e5c2083/python/cpython/issues/109114 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2de02b965c24663368266b7173910ad2b999b4309dd08f6ad897b7695e5c2083/python/cpython/issues/109114 |
| og:image:alt | Bug report Bug description: The following code produces a misleading syntax error. lambda name_3=f'{name_4}': {name_3} type {}[name_4] = {} output (Python 3.12.0rc2+): File "/home/frank/projects/py... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | 15r10nk |
| hostname | github.com |
| expected-hostname | github.com |
| None | ba296ecd3a3521238fe43b3b3b08cc09207ddc21173e16ee656db03803de8e2b |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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 | 6e50fb37e29e4aa0df6386cb485e58b0e3ca97ab |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width