-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Python incorrectly resolves fields in unqualified lookup #1983
Comments
oxisto
added a commit
that referenced
this issue
Jan 25, 2025
oxisto
added a commit
that referenced
this issue
Jan 25, 2025
oxisto
added a commit
that referenced
this issue
Jan 25, 2025
oxisto
added a commit
that referenced
this issue
Jan 26, 2025
oxisto
added a commit
that referenced
this issue
Jan 26, 2025
oxisto
added a commit
that referenced
this issue
Jan 26, 2025
oxisto
added a commit
that referenced
this issue
Jan 26, 2025
oxisto
added a commit
that referenced
this issue
Jan 26, 2025
oxisto
added a commit
that referenced
this issue
Jan 26, 2025
oxisto
added a commit
that referenced
this issue
Jan 28, 2025
oxisto
added a commit
that referenced
this issue
Jan 28, 2025
oxisto
added a commit
that referenced
this issue
Jan 28, 2025
oxisto
added a commit
that referenced
this issue
Jan 28, 2025
oxisto
added a commit
that referenced
this issue
Jan 28, 2025
oxisto
added a commit
that referenced
this issue
Jan 28, 2025
oxisto
added a commit
that referenced
this issue
Jan 29, 2025
oxisto
added a commit
that referenced
this issue
Jan 29, 2025
oxisto
added a commit
that referenced
this issue
Jan 29, 2025
oxisto
added a commit
that referenced
this issue
Jan 29, 2025
…icitReceiver` (#1984) * Introduce `HasExplicitMemberAccess` trait Fixes #1983 * Added trait to GoLanguage as well to be safe * Added more documentation * Spotless * Addressed code review * Using existing trait * added more tests * Fixed the tests as good as they can be fixed in this PR * a -> globalA * Fixed another bug where field declarations were declared twice * Update cpg-language-python/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/PythonAddDeclarationsPass.kt Co-authored-by: Maximilian Kaul <maximilian.kaul@aisec.fraunhofer.de> * Better documentation --------- Co-authored-by: Maximilian Kaul <maximilian.kaul@aisec.fraunhofer.de>
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Currently our python frontend (and probably others?) resolve fields when doing an unqualified lookup, i.e., just looking for
symbol
(but notself.symbol
). But that is not allowed in Python (as well as in Go actually) and this leads to horrendous wrong results.Consider the following snippet:
The
a
in the print statement should resolve to the globala
. Instead it currently resolves to the field declaration ofa
, which is only accessible throughself.a
.This also applies to imports as well
Here,
os
is also wrongfully resolved toMyClass.os
.This might be a bigger issue and effecting all language frontends that require some sort of "qualified" lookup.
The text was updated successfully, but these errors were encountered: