diff options
author | Victor Chahuneau <vchahune@cs.cmu.edu> | 2012-07-05 14:33:14 -0400 |
---|---|---|
committer | Victor Chahuneau <vchahune@cs.cmu.edu> | 2012-07-05 14:33:14 -0400 |
commit | 32a8d92affae91094f2348b73dd26be800e10abd (patch) | |
tree | c9e07a32e500d7bbcc45d227a7517a24e395d157 /python/src/mteval.pxi | |
parent | 7937972d2478a3b377930a30b77b07d2e6e902ba (diff) |
Fix for pow(double, double)
+ [python] check bounds for candidate set
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) |