Skip to content

Commit 0629d3e

Browse files
committed
Python: Enclosing callable for synthetic arguments
1 parent a16d58d commit 0629d3e

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

python/ql/src/semmle/python/dataflow/new/internal/DataFlowPublic.qll

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,13 @@ class PosOverflowNode extends Node, TPosOverflowNode {
287287

288288
override string toString() { result = "PosOverflowNode for " + call.getNode().toString() }
289289

290+
override DataFlowCallable getEnclosingCallable() {
291+
exists(Node node |
292+
node = TCfgNode(call) and
293+
result = node.getEnclosingCallable()
294+
)
295+
}
296+
290297
override Location getLocation() { result = call.getLocation() }
291298
}
292299

@@ -301,6 +308,13 @@ class KwOverflowNode extends Node, TKwOverflowNode {
301308

302309
override string toString() { result = "KwOverflowNode for " + call.getNode().toString() }
303310

311+
override DataFlowCallable getEnclosingCallable() {
312+
exists(Node node |
313+
node = TCfgNode(call) and
314+
result = node.getEnclosingCallable()
315+
)
316+
}
317+
304318
override Location getLocation() { result = call.getLocation() }
305319
}
306320

@@ -316,6 +330,13 @@ class KwUnpacked extends Node, TKwUnpacked {
316330

317331
override string toString() { result = "KwUnpacked " + name }
318332

333+
override DataFlowCallable getEnclosingCallable() {
334+
exists(Node node |
335+
node = TCfgNode(call) and
336+
result = node.getEnclosingCallable()
337+
)
338+
}
339+
319340
override Location getLocation() { result = call.getLocation() }
320341
}
321342

python/ql/test/experimental/dataflow/consistency/dataflow-consistency.expected

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
uniqueEnclosingCallable
22
| test.py:239:27:239:27 | ControlFlowNode for p | Node should have one enclosing callable but has 0. |
3-
| test.py:245:5:245:22 | PosOverflowNode for overflowCallee() | Node should have one enclosing callable but has 0. |
4-
| test.py:248:5:248:26 | KwOverflowNode for overflowCallee() | Node should have one enclosing callable but has 0. |
5-
| test.py:251:5:251:33 | KwOverflowNode for overflowCallee() | Node should have one enclosing callable but has 0. |
63
uniqueType
74
uniqueNodeLocation
85
missingLocation

0 commit comments

Comments
 (0)