Skip to content

Commit 47d777c

Browse files
committed
report loop count only when loop finishes
1 parent c6bfe44 commit 47d777c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/lib/PySequenceContainsNode.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,17 @@ boolean contains(Frame frame, Object container, Object key,
124124
}
125125
try {
126126
if (eqNode.execute(frame, callNext.executeObject(frame, next, iterator), key)) {
127+
if (CompilerDirectives.hasNextTier()) {
128+
LoopNode.reportLoopCount(this, i);
129+
}
127130
return true;
128131
}
129132
} catch (PException e) {
130133
e.expectStopIteration(stopIterationProfile);
131-
return false;
132-
} finally {
133134
if (CompilerDirectives.hasNextTier()) {
134135
LoopNode.reportLoopCount(this, i);
135136
}
137+
return false;
136138
}
137139
}
138140
} else {

0 commit comments

Comments
 (0)