diff options
Diffstat (limited to 'python/src/mteval.pxi')
-rw-r--r-- | python/src/mteval.pxi | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/python/src/mteval.pxi b/python/src/mteval.pxi index 9afb6fe1..67a29f6f 100644 --- a/python/src/mteval.pxi +++ b/python/src/mteval.pxi @@ -73,7 +73,9 @@ cdef class CandidateSet: def __len__(self): return self.cs.size() - def __getitem__(self, unsigned k): + def __getitem__(self,int k): + if not 0 <= k < self.cs.size(): + raise IndexError('candidate set index out of range') cdef Candidate candidate = Candidate() candidate.candidate = &self.cs[0][k] candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats) |