You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python function-local imports can produce calls to unrelated same-named functions #5421
The extracted graph includes a caller → main call edge to the function defined in this file. Python instead binds main in caller to the imported symbol, so that local function is not its target.
A related relative-import case also leaks the binding into unrelated functions: when caller imports target from .helper, another function calling this module's own target can receive an extra edge to helper.target.
Expected behavior
Resolve function-local imports only within their lexical scope, and do not guess a same-named local or corpus target when the imported module is outside the scanned corpus. Preserve genuine calls to the local function and resolvable relative imports.
Evidence
Reproduced against release v0.9.118 (commit 5ce8fceff41d1b636f872b6206b917ec2af7ac54) with a synthetic corpus. The open function-parameter fix #5419 does not cover this import-binding case.
Activity
github-actions commentedon Nov 23, 2026
Thanks for opening this issue, @melhusl-hs. A maintainer will take a look soon.
If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.
To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.
fix(python): address review of function-local import scoping (Graphif…
fix(python): scope function-local imports and suppress shadowed calls (…
fix(python): scope function-local imports and suppress shadowed calls (…
fix(python): scope function-local imports and suppress shadowed calls (…
fix(python): resolve call bindings within lexical scope
fix(python): retain proven import activation targets