Skip to content

Commit

Permalink
Fix nasty bug in data iteration
Browse files Browse the repository at this point in the history
A plot 'ycalc' can change the cache pointer and upset iterating over the
cache, causing an infinite loop. Using a separate cache for the slice
iterator avoids the problem.

Signed-off-by: Jim Easterbrook <jim@jim-easterbrook.me.uk>
  • Loading branch information
jim-easterbrook committed Jul 12, 2019
1 parent 05eab44 commit fe969b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/pywws/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '19.7.0'
_release = '1660'
_commit = '3a926ed'
__version__ = '19.7.1'
_release = '1661'
_commit = '05eab44'
4 changes: 3 additions & 1 deletion src/pywws/filedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,10 @@ def _get_slice(self, i):
a, b = self._slice(i)
if a > b:
return
# use separate cache as something might change self._rd_cache
# during yield
cache = _Cache()
# go to start of slice
cache = self._rd_cache
start, exact = self._get_cache_ptr(cache, a)
# iterate over complete caches
while cache.hi <= b.date():
Expand Down

0 comments on commit fe969b5

Please sign in to comment.