From 8198288f4e5dfe1743abeed1aee780fe1ddcdf07 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Mon, 31 Oct 2011 00:49:07 +0000 Subject: [PATCH] clang.py: Remove use of ternary operators This change is necessary to make this file python 2.4 compatible. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143324 91177308-0d34-0410-b5e6-96231b3b80d8 --- bindings/python/clang/cindex.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py index 9ab9ae8a17..1c62cc9555 100644 --- a/bindings/python/clang/cindex.py +++ b/bindings/python/clang/cindex.py @@ -111,7 +111,10 @@ class SourceLocation(Structure): if self._data is None: f, l, c, o = c_object_p(), c_uint(), c_uint(), c_uint() SourceLocation_loc(self, byref(f), byref(l), byref(c), byref(o)) - f = File(f) if f else None + if f: + f = File(f) + else: + f = None self._data = (f, int(l.value), int(c.value), int(o.value)) return self._data @@ -144,8 +147,12 @@ class SourceLocation(Structure): return self._get_instantiation()[3] def __repr__(self): + if self.file: + filename = self.file.name + else: + filename = None return "" % ( - self.file.name if self.file else None, self.line, self.column) + filename, self.line, self.column) class SourceRange(Structure): """