Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion python/ql/src/semmle/python/objects/Sequences.qll
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ abstract class TupleObjectInternal extends SequenceObjectInternal {
}

private string item(int n) {
result = this.getItem(n).toString()
exists(ObjectInternal item | item = this.getItem(n) |
// To avoid infinite recursion, nested tuples are replaced with the string "...".
if item instanceof TupleObjectInternal then
result = "(...)"
else
result = item.toString()
)
or
n in [0..this.length()-1] and
not exists(this.getItem(n)) and result = "?"
Expand Down