From 32a8d92affae91094f2348b73dd26be800e10abd Mon Sep 17 00:00:00 2001 From: Victor Chahuneau Date: Thu, 5 Jul 2012 14:33:14 -0400 Subject: Fix for pow(double, double) + [python] check bounds for candidate set --- python/src/mteval.pxi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'python/src/mteval.pxi') 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) -- cgit v1.2.3