Skip to content

Python: Remove some simple uses of points-to#21350

Draft
tausbn wants to merge 5 commits intomainfrom
tausbn/python-remove-simple-points-to
Draft

Python: Remove some simple uses of points-to#21350
tausbn wants to merge 5 commits intomainfrom
tausbn/python-remove-simple-points-to

Conversation

@tausbn
Copy link
Contributor

@tausbn tausbn commented Feb 19, 2026

WIP

Moves the classes/predicates that _actually_ depend on points-to to the
`LegacyPointsTo` module, leaving behind a module that contains all of
the metrics-related stuff (line counts, nesting depth, etc.) that don't
need points-to to be evaluated.

Consequently, `Metrics` is now no longer a private import in
`python.qll`.
The ones that no longer require points-to no longer import
`LegacyPointsTo`. The ones that do use the specific
`...MetricsWithPointsTo` classes that are applicable.
Removes the use of points-to for accessing various built-ins from three
of the queries. In order for this to work I had to extend the lists of
known built-ins slightly.
Uses a (perhaps) slightly coarser approximation of what modules are
imported, but it's probably fine.
is_print_stmt(p) and
// TODO: Need to discuss how we would like to handle ModuleObject.getKind in the glorious future
exists(ModuleValue m | m.getScope() = p.getScope() and m.isUsedAsModule()) and
is_used_as_module(p.getScope().(Module)) and

Check warning

Code scanning / CodeQL

Redundant cast Warning

Redundant cast to
Module
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments