Title: bpo-46841: Don't jump during `throw()` by brandtbucher · Pull Request #31968 · python/cpython · GitHub
Open Graph Title: bpo-46841: Don't jump during `throw()` by brandtbucher · Pull Request #31968 · python/cpython
X Title: bpo-46841: Don't jump during `throw()` by brandtbucher · Pull Request #31968 · python/cpython
Description: We currently perform some awkward control flow in _gen_throw to handle the case where a yield from/await sub-iterator returns a value during a throw() call. The current code is quite sensitive to slight changes in the bytecode, and is technically invalid for three reasons: It doesn't properly handle the case where SEND has an EXTENDED_ARG. It scans backwards, which is susceptible to accidentally reading inline cache entries as if they were valid instructions. It jumps from a YIELD_VALUE instruction, which isn't really supposed to be possible. Instead, this PR handles this edge-case by pushing NULL and the return value in place of the sub-iterator and its next value. SEND then handles this by adjusting the stack and jumping the same way it does when handling other return values. This also updates the docs for SEND (which are currently lacking a bit). https://bugs.python.org/issue46841
Open Graph Description: We currently perform some awkward control flow in _gen_throw to handle the case where a yield from/await sub-iterator returns a value during a throw() call. The current code is quite sensitive to s...
X Description: We currently perform some awkward control flow in _gen_throw to handle the case where a yield from/await sub-iterator returns a value during a throw() call. The current code is quite sensitive to s...
Opengraph URL: https://github.com/python/cpython/pull/31968
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:0aab9382-857b-99bb-3008-284e1210b8b9 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BB98:36419E:917B7E:BD0315:696AF24F |
| html-safe-nonce | e72d9a3c1d7fc90a4e78842434880545e983341b7fe790552362829a9c78e426 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQjk4OjM2NDE5RTo5MTdCN0U6QkQwMzE1OjY5NkFGMjRGIiwidmlzaXRvcl9pZCI6IjU3MzY1NzE5MTk2MTk3ODExOTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 67990fb31339a25b17d783a118ad27bedc2901d58e01d15a6980a61351c9e2ec |
| hovercard-subject-tag | pull_request:882843216 |
| 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/31968/files |
| twitter:image | https://avatars.githubusercontent.com/u/40968415?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40968415?s=400&v=4 |
| og:image:alt | We currently perform some awkward control flow in _gen_throw to handle the case where a yield from/await sub-iterator returns a value during a throw() call. The current code is quite sensitive to s... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| 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 | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width