Skip to content

Commit 25a68c4

Browse files
committed
Python: Include @yoff's suggestion on synthetic *args handling
1 parent 41ebb4f commit 25a68c4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ class SyntheticPreUpdateNode extends Node, TSyntheticPreUpdateNode {
9696
* nodes. My gut feeling at that this simple approach will be good enough, but if we need to get it more
9797
* precise, it should be possible to do it like this.
9898
*
99+
* In PR review, @yoff suggested an alternative approach for more precise handling:
100+
*
101+
* - At the call site, all positional arguments are stored into a synthetic starArgs argument, always tarting at index 0
102+
* - This is sent to a synthetic star parameter
103+
* - At the receiving end, we know the offset of a potential real star parameter, so we can define read steps accordingly: In foo, we read from the synthetic star parameter at index 1 and store to the real star parameter at index 0.
104+
*
99105
* ```py
100106
* def foo(one, *args): ...
101107
* def bar(*args): ...

0 commit comments

Comments
 (0)