Skip to content

Python: Port UnusedExceptionObject.ql#21601

Open
tausbn wants to merge 1 commit intomainfrom
tausbn/python-port-unused-exception-object
Open

Python: Port UnusedExceptionObject.ql#21601
tausbn wants to merge 1 commit intomainfrom
tausbn/python-port-unused-exception-object

Conversation

@tausbn
Copy link
Copy Markdown
Contributor

@tausbn tausbn commented Mar 27, 2026

NB: At a later point, the exception modelling will be consolidated into a submodule of DataFlowDispatch.

Depending on whether other queries depend on this, we may end up moving
the exception utility functions to a more central location.
@tausbn
Copy link
Copy Markdown
Contributor Author

tausbn commented Apr 7, 2026

DCA looks good. Gained 4 results that are likely true positives, and lost 6 false positives (that were in test code anyway).

@tausbn tausbn marked this pull request as ready for review April 7, 2026 21:27
@tausbn tausbn requested a review from a team as a code owner April 7, 2026 21:27
Copilot AI review requested due to automatic review settings April 7, 2026 21:27
@tausbn tausbn added the no-change-note-required This PR does not need a change note label Apr 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Ports the py/unused-exception-object query to use the newer Python dataflow/call-graph infrastructure (via DataFlowDispatch/ApiGraphs) rather than legacy points-to, aligning the query with the ongoing modernization of Python modeling.

Changes:

  • Replaces LegacyPointsTo-based exception class resolution with DataFlowDispatch + ApiGraphs-based logic.
  • Adds predicates to recognize exception instantiations for both user-defined exception subclasses and builtin exception classes.
Show a summary per file
File Description
python/ql/src/Statements/UnusedExceptionObject.ql Migrates exception-instantiation detection from legacy points-to to the newer dispatch/api-graph based approach.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

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

Labels

no-change-note-required This PR does not need a change note Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants