[cfe-commits] r143324 - /cfe/trunk/bindings/python/clang/cindex.py

Tobias Grosser grosser at fim.uni-passau.de
Sun Oct 30 17:49:07 PDT 2011


Author: grosser
Date: Sun Oct 30 19:49:07 2011
New Revision: 143324

URL: http://llvm.org/viewvc/llvm-project?rev=143324&view=rev
Log:
clang.py: Remove use of ternary operators

This change is necessary to make this file python 2.4 compatible.

Modified:
    cfe/trunk/bindings/python/clang/cindex.py

Modified: cfe/trunk/bindings/python/clang/cindex.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/clang/cindex.py?rev=143324&r1=143323&r2=143324&view=diff
==============================================================================
--- cfe/trunk/bindings/python/clang/cindex.py (original)
+++ cfe/trunk/bindings/python/clang/cindex.py Sun Oct 30 19:49:07 2011
@@ -111,7 +111,10 @@
         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 @@
         return self._get_instantiation()[3]
 
     def __repr__(self):
+        if self.file:
+            filename = self.file.name
+        else:
+            filename = None
         return "<SourceLocation file %r, line %r, column %r>" % (
-            self.file.name if self.file else None, self.line, self.column)
+            filename, self.line, self.column)
 
 class SourceRange(Structure):
     """





More information about the cfe-commits mailing list