Title: Python: inline init_module_submodule_defn into ImportResolution by yoff · Pull Request #21930 · github/codeql · GitHub
Open Graph Title: Python: inline init_module_submodule_defn into ImportResolution by yoff · Pull Request #21930 · github/codeql
X Title: Python: inline init_module_submodule_defn into ImportResolution by yoff · Pull Request #21930 · github/codeql
Description: Factored out of #21925 (shared-CFG migration). The new-dataflow ImportResolution module only imported semmle.python.essa.SsaDefinitions to call the 5-line helper SsaSource::init_module_submodule_defn. Inlining it locally drops the dependency on legacy SSA definitions — making new/internal/ImportResolution.qll independent of essa/. Semantic-noop argument SsaSourceVariable.getName() and Variable.getId() both project the same DB column variable(_, _, result), so the rename in the inlined body is safe. The old call init_module_submodule_defn(var.getSourceVariable(), package.getEntryNode()) constrained init = package via the join init.getEntryNode() = package.getEntryNode() plus var.getScope() = init. With Scope.getEntryNode() being functional, this is equivalent to passing package directly. The var instanceof GlobalVariable check in the old body is now expressed via the parameter type. Verification RA dump of python/ql/test/library-tests/dataflow/global-flow/accesses.ql shows only the expected predicate-rename shuffle (no semantic shape change in any other predicate). All 70 tests under python/ql/test/library-tests/dataflow and python/ql/test/library-tests/ApiGraphs pass without reblessing. Investigation note (negative result worth recording) I had originally hoped to fold two other ESSA-bypass rewrites into this PR — switching definitionFlowStep from AssignmentDefinition to DefinitionNode + NameNode, and switching ModuleVariableNode.getAWrite from EssaNodeDefinition.definedBy to NameNode.defines — but they are not semantic noops on main. Old ESSA's EssaNodeDefinition (and hence AssignmentDefinition) is liveness-pruned at SsaCompute.qll:108-113, so bypassing it reintroduces dead writes. accesses.ql immediately picks up the dead g_mod = [] line. Those rewrites have to stay on the flip PR (#21925) where they're justified by the shared-SSA prune semantics. Stacked under #21926.
Open Graph Description: Factored out of #21925 (shared-CFG migration). The new-dataflow ImportResolution module only imported semmle.python.essa.SsaDefinitions to call the 5-line helper SsaSource::init_module_submodule_de...
X Description: Factored out of #21925 (shared-CFG migration). The new-dataflow ImportResolution module only imported semmle.python.essa.SsaDefinitions to call the 5-line helper SsaSource::init_module_submodule_de...
Opengraph URL: https://github.com/github/codeql/pull/21930
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:893a0b07-2d9c-78c3-269d-dd38b8f1df6f |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9350:3EE845:838BFF4:B7CB3B6:6A50117B |
| html-safe-nonce | 869a742fcf8aade3c437841a653462e46305a9e2c053bfc2d1df7851022ea46a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzUwOjNFRTg0NTo4MzhCRkY0OkI3Q0IzQjY6NkE1MDExN0IiLCJ2aXNpdG9yX2lkIjoiMzgxMDE1MTkxMzM5NzE2MjM2MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7219126e2687ee288b08ed99f66273bc4ce8f0d44cec4adda216783629d78457 |
| hovercard-subject-tag | pull_request:3786644077 |
| 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/github/codeql/pull/21930/files |
| twitter:image | https://avatars.githubusercontent.com/u/647347?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/647347?s=400&v=4 |
| og:image:alt | Factored out of #21925 (shared-CFG migration). The new-dataflow ImportResolution module only imported semmle.python.essa.SsaDefinitions to call the 5-line helper SsaSource::init_module_submodule_de... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | fe4f38b24922a1ce81c1708c3793b47c185599b9144ab94f6ca846b00698058d |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/github/codeql git https://github.com/github/codeql.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 143040428 |
| octolytics-dimension-repository_nwo | github/codeql |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 143040428 |
| octolytics-dimension-repository_network_root_nwo | github/codeql |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 42b6390c91978a16f9196c38c7a00e9bf21f37e7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width