Opened 9 years ago
Last modified 9 years ago
#11902 closed defect
Fix config.parse_if_needed cache invalidation — at Initial Version
Reported by: | Peter Suter | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.3 |
Component: | general | Version: | |
Severity: | normal | Keywords: | |
Cc: | Ryan J Ollos | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
42:ticket:5525 noted:
It appears there is an unused protected attribute
_cache
in [9037#file11]: tags/trac-1.0.2/trac/config.py@:293-294#L264. Could that be removed?
But perhaps some other variable was meant to be cleared, e.g. self._sections = {}
or for k in self._sections: self._sections[k]._cache = {}
.
It looks like this scenario would currently fail and be fixed by that cache invalidation:
# config inherits parent.ini containing [a] b=x config.get('a', 'b') # caches 'x' in config._sections['a']._cache['b'] # change parent.ini to [a] b=y config.parse_if_needed() # does not invalidate that cache config.get('a', 'b') # should return 'y' but returns cached 'x'
We should add a testcase and fix the code.
Change History (1)
by , 9 years ago
Attachment: | T11902_config_parse_if_needed_invalidate_cache.patch added |
---|
Note:
See TracTickets
for help on using tickets.