Title: gh-104377: fix cell in comprehension that is free in outer scope by carljm · Pull Request #104394 · python/cpython · GitHub
Open Graph Title: gh-104377: fix cell in comprehension that is free in outer scope by carljm · Pull Request #104394 · python/cpython
X Title: gh-104377: fix cell in comprehension that is free in outer scope by carljm · Pull Request #104394 · python/cpython
Description: Fix the case where a comprehension wraps its iteration variable in a cell inside the comprehension (i.e. it's used in a lambda's closure), but that same variable name is free in the outer scope. Also added a few tests for explicit globals (none of these cases required fixes) and verified that now every possible combination of inner and outer scope is tested. Also fixed accidental namespace reuse in listcomps test harness, which revealed that two existing tests should not have been passing (and should not pass) when run in class scope; run these tests only in module and function scope. Fixes #104377. Issue: gh-104377
Open Graph Description: Fix the case where a comprehension wraps its iteration variable in a cell inside the comprehension (i.e. it's used in a lambda's closure), but that same variable name is free in the outer s...
X Description: Fix the case where a comprehension wraps its iteration variable in a cell inside the comprehension (i.e. it's used in a lambda's closure), but that same variable name is free in the...
Opengraph URL: https://github.com/python/cpython/pull/104394
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ebb80dee-42e4-4ec4-7aba-573b4ddcb034 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8E18:1FC3E6:A84716:ECADCE:696A1C80 |
| html-safe-nonce | 833cfe44d866f7e7555461096c9e480c849297bbbeb99bde2b36948c193f8251 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTE4OjFGQzNFNjpBODQ3MTY6RUNBRENFOjY5NkExQzgwIiwidmlzaXRvcl9pZCI6IjMxMTg4MTI4NDE4ODM4NjgyODgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ab8ec23b13f0f3921aee3699259affa54a63c4f628248da0a85db8da176f225d |
| hovercard-subject-tag | pull_request:1347324011 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/python/cpython/pull/104394/files |
| twitter:image | https://avatars.githubusercontent.com/u/61586?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/61586?s=400&v=4 |
| og:image:alt | Fix the case where a comprehension wraps its iteration variable in a cell inside the comprehension (i.e. it's used in a lambda's closure), but that same variable name is free in the outer s... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 014f3d193f36b7d393f88ca22d06fbacd370800b40a547c1ea67291e02dc8ea3 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d515f6f09fa57a93bf90355cb894eb84ca4f458f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width