Skip to content

Commit 5da546c

Browse files
webassembly.py: Ensure Unique Keys in @memoize Decorator (#20218)
Previously, the key used in the @memoize decorator was not unique. By including the method's arguments in the key, we now ensure that the key is unique for each call. Fixes #20217
1 parent 0ca675f commit 5da546c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/webassembly.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def memoize(method):
6060
@wraps(method)
6161
def wrapper(self, *args, **kwargs):
6262
assert not kwargs
63-
key = method
63+
key = (method.__name__, args)
6464
if key not in self._cache:
6565
self._cache[key] = method(self, *args, **kwargs)
6666
return self._cache[key]

0 commit comments

Comments
 (0)