aboutsummaryrefslogtreecommitdiffstats
path: root/.be/bugs/2aa60b34-2c8d-4f41-bb97-a57309523262
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-07-21 12:07:27 -0400
committerW. Trevor King <wking@drexel.edu>2009-07-21 12:07:27 -0400
commit795b15c60fd43e5d393f53926d679fb29c609359 (patch)
tree582700bef457eaf8386bdec77d78a1b10a8e225e /.be/bugs/2aa60b34-2c8d-4f41-bb97-a57309523262
parent680b3a15076d24d9e1ba5cd96623081d74dbd441 (diff)
downloadbugseverywhere-795b15c60fd43e5d393f53926d679fb29c609359.tar.gz
Fixed extra change-hook save in testChangeHookMutableProperty.
The actual fix was @@ -339,7 +355,10 @@ fset = funcs.get("fset") name = funcs.get("name", "<unknown>") def _fget(self, new_value=None, from_fset=False): # only used if mutable == True - value = fget(self) + if from_fset == True: + value = new_value # compare new value with cached + else: + value = fget(self) # compare current value with cached if _cmp_cached_mutable_property(self, "change hook property", name, value) != 0: # there has been a change, cache new value old_value = _get_cached_mutable_property(self, "change hook property", name) The reason for the double-save was: >>> print t.settings["List-type"]==EMPTY True (the cached value here is EMPTY) >>> t.list_type = [] (old fget compares cached EMPTY to current EMPTY, no change, so no cache. fset notices change and saves EMPTY->[]) >>> t.list_type.append(5) (now fget notices the change EMPTY->[], caches [], and calls extra save) The new way: >>> print t.settings["List-type"]==EMPTY True (the cached value here is EMPTY) >>> t.list_type = [] (fget compares cached EMPTY to new [] and saves EMPTY->[]) >>> t.list_type.append(5) (fget sees no change ([]->[]), which is correct) In addition to the fix and the related corrections to testChangeHookMutableProperty, I added details about mutables to all relevant docstrings and stripped trailing whitespace from both files.
Diffstat (limited to '.be/bugs/2aa60b34-2c8d-4f41-bb97-a57309523262')
0 files changed, 0 insertions, 0 deletions