Skip to content

Commit 99adb88

Browse files
committed
Avoid nested KeyError exception for threaded_cached_property
1 parent 409f242 commit 99adb88

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cached_property.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ def __get__(self, obj, cls):
6868
try:
6969
# check if the value was computed before the lock was acquired
7070
return obj_dict[name]
71-
7271
except KeyError:
73-
# if not, do the calculation and release the lock
74-
return obj_dict.setdefault(name, self.func(obj))
72+
pass
73+
# if not, do the calculation and release the lock
74+
return obj_dict.setdefault(name, self.func(obj))
7575

7676

7777
class cached_property_with_ttl(object):

0 commit comments

Comments
 (0)