aboutsummaryrefslogtreecommitdiff
path: root/bindings/python/clang/cindex.py
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2011-02-05 17:53:51 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2011-02-05 17:53:51 +0000
commitf498e00a30ca7fdaf4f49e778862f4cf84ffab2a (patch)
tree53ee4bca6737d7fec9c79e1c306128be65b04fad /bindings/python/clang/cindex.py
parentff090ca42aa319e1bbdde38b3940219ea11e07b3 (diff)
python bindings: fix Diagnostics.range iterator
The iterator did never throw an IndexError. It was therefore not possible to use it in a normal foreach loop as that loop would never stop. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124953 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/python/clang/cindex.py')
-rw-r--r--bindings/python/clang/cindex.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py
index c398656a0a..ee0abd6315 100644
--- a/bindings/python/clang/cindex.py
+++ b/bindings/python/clang/cindex.py
@@ -215,6 +215,8 @@ class Diagnostic(object):
return int(_clang_getDiagnosticNumRanges(self.diag))
def __getitem__(self, key):
+ if (key >= len(self)):
+ raise IndexError
return _clang_getDiagnosticRange(self.diag, key)
return RangeIterator(self)