Skip to content

Commit 33c3e32

Browse files
committed
Fix stack overflow for self-nested pymap.
1 parent ffce9c2 commit 33c3e32

File tree

1 file changed

+11
-0
lines changed
  • src/main/java/com/hubspot/jinjava/objects/collections

1 file changed

+11
-0
lines changed

src/main/java/com/hubspot/jinjava/objects/collections/PyMap.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,15 @@ public void putAll(Map<? extends String, ? extends Object> m) {
5858
}
5959
super.putAll(m);
6060
}
61+
62+
@Override
63+
public int hashCode() {
64+
int h = 0;
65+
for (Entry<String, Object> entry : map.entrySet()) {
66+
if (entry.getValue() != map && entry.getValue() != this) {
67+
h += entry.hashCode();
68+
}
69+
}
70+
return h;
71+
}
6172
}

0 commit comments

Comments
 (0)