Skip to content

Commit 8f4826f

Browse files
committed
Fix issue w/cached property.
Fixes #201
1 parent 593ec14 commit 8f4826f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

walrus/cache.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,15 @@ def now(self):
257257
clock = Clock()
258258
print clock.now
259259
"""
260+
def key_wrapper(a, k):
261+
instance = a[0]
262+
return key_fn((id(instance), a), k)
263+
260264
this = self
261265

262266
class _cached_property(object):
263267
def __init__(self, fn):
264-
self._fn = this.cached(key_fn, timeout)(fn)
268+
self._fn = this.cached(key_wrapper, timeout)(fn)
265269

266270
def __get__(self, instance, instance_type=None):
267271
if instance is None:

0 commit comments

Comments
 (0)