Title: Consume nested scope tables in optimized-out asserts by youknowone · Pull Request #7438 · RustPython/RustPython · GitHub
Open Graph Title: Consume nested scope tables in optimized-out asserts by youknowone · Pull Request #7438 · RustPython/RustPython
X Title: Consume nested scope tables in optimized-out asserts by youknowone · Pull Request #7438 · RustPython/RustPython
Description: When -O flag removes assert statements, any nested scopes (generators, comprehensions, lambdas) inside the assert expression still have symbol tables in the sub_tables list. Without consuming them, the next_sub_table index gets misaligned, causing later scopes to use wrong symbol tables. Walk the skipped assert expression with an AST visitor to find and consume nested scope symbol tables, keeping the index aligned with AST traversal order. Summary by CodeRabbit Bug Fixes Fixed scope-alignment and traversal issues during assertion optimization so nested scopes in complex expressions (lambdas, comprehensions, generators, defaults) are consumed in the correct order. Tests Added tests covering optimized assertions with nested scopes and default values to ensure stable behavior.
Open Graph Description: When -O flag removes assert statements, any nested scopes (generators, comprehensions, lambdas) inside the assert expression still have symbol tables in the sub_tables list. Without consuming them,...
X Description: When -O flag removes assert statements, any nested scopes (generators, comprehensions, lambdas) inside the assert expression still have symbol tables in the sub_tables list. Without consuming them,...
Opengraph URL: https://github.com/RustPython/RustPython/pull/7438
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:e771c215-d019-14da-54f4-c372a9a6fc2a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9B54:3AA93C:3299D7:440D62:6A5ECF07 |
| html-safe-nonce | 85e0183fd3c76542c31584d9a392d4f55103adc02d538e86e7492e54e2e5306f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QjU0OjNBQTkzQzozMjk5RDc6NDQwRDYyOjZBNUVDRjA3IiwidmlzaXRvcl9pZCI6IjM5Nzk0MzkwNzU4NjcxNTIxMzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7f5d99fe890f69d471ebf369a4f3ebf3656cc2b20574495b591e591542709a6f |
| hovercard-subject-tag | pull_request:3402079710 |
| 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/RustPython/RustPython/pull/7438/files |
| twitter:image | https://avatars.githubusercontent.com/u/69878?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/69878?s=400&v=4 |
| og:image:alt | When -O flag removes assert statements, any nested scopes (generators, comprehensions, lambdas) inside the assert expression still have symbol tables in the sub_tables list. Without consuming them,... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9bd00899c80f8b6ea4e7a96c99290af4722b0befdf9e021b19232cbd6f993660 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| 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 | 9996307881fdf9017d864a20b3dfe5aae4dddd3e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width