Python: target SSA variable rather than Cfg node

also add "INTERNAL: Do not use."
also give test functions different names
This commit is contained in:
Rasmus Lerchedahl Petersen
2021-03-08 08:04:42 +01:00
parent 296297915c
commit b36e0d0be7
3 changed files with 14 additions and 5 deletions

View File

@@ -5,6 +5,8 @@ import semmle.python.dataflow.new.DataFlow
private import semmle.python.ApiGraphs
/**
* INTERNAL: Do not use.
*
* A data-flow node that carries information about a raised exception.
* Such information should rarely be exposed directly to the user.
*/
@@ -25,7 +27,10 @@ private class TracebackFunctionCall extends ExceptionInfo, DataFlow::CallCfgNode
/** A caught exception. */
private class CaughtException extends ExceptionInfo {
CaughtException() { this.asExpr() = any(ExceptStmt s).getName() }
CaughtException() {
this.asVar().getDefinition().(EssaNodeDefinition).getDefiningNode().getNode() =
any(ExceptStmt s).getName()
}
}
/** A call to `sys.exc_info`. */