Title: `f'"{var:}"'` adds redundant empty string literal in AST in 3.12 · Issue #106396 · python/cpython · GitHub
Open Graph Title: `f'"{var:}"'` adds redundant empty string literal in AST in 3.12 · Issue #106396 · python/cpython
X Title: `f'"{var:}"'` adds redundant empty string literal in AST in 3.12 · Issue #106396 · python/cpython
Description: 3.11: >>> import ast >>> print(ast.dump(ast.parse("""f'"{var:}"'"""), indent=2)) Module( body=[ Expr( value=JoinedStr( values=[ Constant(value='"'), FormattedValue( value=Name(id='var', ctx=Load()), conversion=-1, format_spec=JoinedStr(v...
Open Graph Description: 3.11: >>> import ast >>> print(ast.dump(ast.parse("""f'"{var:}"'"""), indent=2)) Module( body=[ Expr( value=JoinedStr( values=[ Constant(value='"'), FormattedValue( value=Name(id='var', ctx=Load())...
X Description: 3.11: >>> import ast >>> print(ast.dump(ast.parse("""f'"{var:}"'"""), indent=2)) Module( body=[ Expr( value=JoinedStr( values=[ Con...
Opengraph URL: https://github.com/python/cpython/issues/106396
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`f'\"{var:}\"'` adds redundant empty string literal in AST in 3.12","articleBody":"3.11:\r\n\r\n```python\r\n\u003e\u003e\u003e import ast\r\n\u003e\u003e\u003e print(ast.dump(ast.parse(\"\"\"f'\"{var:}\"'\"\"\"), indent=2))\r\nModule(\r\n body=[\r\n Expr(\r\n value=JoinedStr(\r\n values=[\r\n Constant(value='\"'),\r\n FormattedValue(\r\n value=Name(id='var', ctx=Load()),\r\n conversion=-1,\r\n format_spec=JoinedStr(values=[])),\r\n Constant(value='\"')]))],\r\n type_ignores=[])\r\n```\r\n\r\n3.12:\r\n\r\n```python\r\n\u003e\u003e\u003e import ast\r\n\u003e\u003e\u003e print(ast.dump(ast.parse(\"\"\"f'\"{var:}\"'\"\"\"), indent=2))\r\nModule(\r\n body=[\r\n Expr(\r\n value=JoinedStr(\r\n values=[\r\n Constant(value='\"'),\r\n FormattedValue(\r\n value=Name(id='var', ctx=Load()),\r\n conversion=-1,\r\n format_spec=JoinedStr(\r\n values=[\r\n Constant(value='')])),\r\n Constant(value='\"')]))],\r\n type_ignores=[])\r\n```\r\n\r\nThis affects several linters:\r\n1. https://github.com/python/mypy/pull/15577\r\n2. https://github.com/PyCQA/flake8-bugbear/issues/393\r\n\r\nIs this a bug? Or is it a feature?\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-106401\n* gh-106416\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/sobolevn","@type":"Person","name":"sobolevn"},"datePublished":"2023-07-04T03:48:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/106396/cpython/issues/106396"}
| 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:f1ea535d-c6df-ae0e-f453-ca280e367812 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C576:339E6E:26D61B:33F460:6969A9B7 |
| html-safe-nonce | b2e3f728b6611e74ab1e0164bb2f240d648a1a871f4066bc9415568019c43029 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNTc2OjMzOUU2RToyNkQ2MUI6MzNGNDYwOjY5NjlBOUI3IiwidmlzaXRvcl9pZCI6IjU1Nzg3ODI1ODk3NTE1NDQ4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8332a014c9c79edcf232070a85642a49f40d277c411ac94f3f6725f663d78858 |
| hovercard-subject-tag | issue:1787092716 |
| 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/106396/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1e4c5a46735d73699e22e821c3800ee2f2c59c8779ac377d7821a853912a1375/python/cpython/issues/106396 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1e4c5a46735d73699e22e821c3800ee2f2c59c8779ac377d7821a853912a1375/python/cpython/issues/106396 |
| og:image:alt | 3.11: >>> import ast >>> print(ast.dump(ast.parse("""f'"{var:}"'"""), indent=2)) Module( body=[ Expr( value=JoinedStr( values=[ Constant(value='"'), FormattedValue( value=Name(id='var', ctx=Load())... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sobolevn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 24c4c97a2d520cb286b35e1a4c22d7a4df3c26a2fa28dd7cdf0e65db327b4de7 |
| 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 | 124667f43168afb6c9c03b7c02eb5b1d2e1be3d9 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width