Title: PEP 709: Comprehension iteration variable leaks into outer locals() · Issue #104619 · python/cpython · GitHub
Open Graph Title: PEP 709: Comprehension iteration variable leaks into outer locals() · Issue #104619 · python/cpython
X Title: PEP 709: Comprehension iteration variable leaks into outer locals() · Issue #104619 · python/cpython
Description: Code: def __b(): [__a for __b in [__b] for _ in []] return locals() On #104603, calling this gives: >>> __b() {'__b':
Open Graph Description: Code: def __b(): [__a for __b in [__b] for _ in []] return locals() On #104603, calling this gives: >>> __b() {'__b':
X Description: Code: def __b(): [__a for __b in [__b] for _ in []] return locals() On #104603, calling this gives: >>> __b() {'__b': <function __b at 0x100e3e390>} But on 3.11: >>>...
Opengraph URL: https://github.com/python/cpython/issues/104619
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PEP 709: Comprehension iteration variable leaks into outer locals()","articleBody":"Code:\r\n\r\n```python\r\ndef __b():\r\n [__a for __b in [__b] for _ in []]\r\n return locals()\r\n```\r\n\r\nOn #104603, calling this gives:\r\n```\r\n\u003e\u003e\u003e __b()\r\n{'__b': \u003cfunction __b at 0x100e3e390\u003e}\r\n```\r\n\r\nBut on 3.11:\r\n\r\n```\r\n\u003e\u003e\u003e __b()\r\n{}\r\n```\r\n\r\nSo the locals() in the outer function can now include comprehension variables from the inner comprehension. cc @carljm \n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-104637\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/JelleZijlstra","@type":"Person","name":"JelleZijlstra"},"datePublished":"2023-05-18T17:20:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/104619/cpython/issues/104619"}
| 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:a8902723-9503-3151-32e8-2933d0e82a5c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E80C:106C25:419462:5CF939:696A4599 |
| html-safe-nonce | b26dc33da91d87997f6fd98b247b7499693009217a155f2b30ca76d05acc7691 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODBDOjEwNkMyNTo0MTk0NjI6NUNGOTM5OjY5NkE0NTk5IiwidmlzaXRvcl9pZCI6Ijc3MzUzMzQ2ODQyNDg5MTc0MDEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cf9d51f5def4e5ab4580a5dff4f8a1927b8883b5c358ed5c94656f52e30e5dc7 |
| hovercard-subject-tag | issue:1715988007 |
| 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/104619/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5f25f1a363fc5c3cf119cc35686e2fcf6fcfa536deab541d9d4060f822ea5fe8/python/cpython/issues/104619 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5f25f1a363fc5c3cf119cc35686e2fcf6fcfa536deab541d9d4060f822ea5fe8/python/cpython/issues/104619 |
| og:image:alt | Code: def __b(): [__a for __b in [__b] for _ in []] return locals() On #104603, calling this gives: >>> __b() {'__b': |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JelleZijlstra |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3f871c8e07f0ae1886fa8dac284166d28b09ad5bada6476fc10b674e489788ef |
| 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 | 63c426b30d262aba269ef14c40e3c817b384cd61 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width