Fix the previous commit and add more test assertions to show why it was wrong.
authorGeorge Sakkis <george.sakkis@gmail.com>
Mon, 20 Apr 2015 00:46:09 +0000 (03:46 +0300)
committerGeorge Sakkis <george.sakkis@gmail.com>
Mon, 20 Apr 2015 00:56:44 +0000 (03:56 +0300)
commit4d0bc4336ea3e1de132b2aa29cf6dc1ee2c6fc8b
tree039bc9517d7c8476be469d8c6be293491a0109f6
parentdf46e7da061f0514101dd725217974fa0bfe7011
Fix the previous commit and add more test assertions to show why it was wrong.

Although the previous commit correctly cached and returned only the first computed
value (since dict.setdefault() is atomic), the actual computation could be performed
more than once in multithreaded environment, with all but the first computed values
being discarded.
cached_property.py
tests/test_cached_property.py