esheldon/fitsio — pull request #17 by demitri (2014-03-20 17:01:33+00:00)
Title: Adding fix when iter_row_buffer exceeds number of rows in table.

Given this example:

fits=fitsio.FITS(filename,iter_row_buffer=1000)
for row in fits[1]:
print row

If the number of rows in the table exceeds the specified buffer, this leads to the following crash:

Traceback (most recent call last):
File "script.py", line 102, in
for row in photoFieldFile.dataHDU:
File "/sys/pkg/python/2.7.3_rhel6/lib/python2.7/site-packages/fitsio/fitslib.py", line 1828, in __getitem__
array = self.read(rows=res)
File "/sys/pkg/python/2.7.3_rhel6/lib/python2.7/site-packages/fitsio/fitslib.py", line 1623, in read
data = self.read_rows(rows, **keys)
File "/sys/pkg/python/2.7.3_rhel6/lib/python2.7/site-packages/fitsio/fitslib.py", line 2026, in read_rows
rows = self._extract_rows(rows)
File "/sys/pkg/python/2.7.3_rhel6/lib/python2.7/site-packages/fitsio/fitslib.py", line 2311, in _extract_rows
raise ValueError("rows must be in [%d,%d]" % (0,maxrow))
ValueError: rows must be in [0,174]