r348129 - Portable Python script across Python version

Serge Guelton via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 3 04:41:35 PST 2018


Author: serge_sans_paille
Date: Mon Dec  3 04:41:35 2018
New Revision: 348129

URL: http://llvm.org/viewvc/llvm-project?rev=348129&view=rev
Log:
Portable Python script across Python version

Python3 does not support type destructuring in function parameters.

Differential Revision: https://reviews.llvm.org/D55198

Modified:
    cfe/trunk/utils/ABITest/Enumeration.py
    cfe/trunk/utils/ABITest/TypeGen.py

Modified: cfe/trunk/utils/ABITest/Enumeration.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ABITest/Enumeration.py?rev=348129&r1=348128&r2=348129&view=diff
==============================================================================
--- cfe/trunk/utils/ABITest/Enumeration.py (original)
+++ cfe/trunk/utils/ABITest/Enumeration.py Mon Dec  3 04:41:35 2018
@@ -46,7 +46,8 @@ aleph0 = Aleph0()
 def base(line):
     return line*(line+1)//2
 
-def pairToN((x,y)):
+def pairToN(pair):
+    x,y = pair
     line,index = x+y,y
     return base(line)+index
 

Modified: cfe/trunk/utils/ABITest/TypeGen.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ABITest/TypeGen.py?rev=348129&r1=348128&r2=348129&view=diff
==============================================================================
--- cfe/trunk/utils/ABITest/TypeGen.py (original)
+++ cfe/trunk/utils/ABITest/TypeGen.py Mon Dec  3 04:41:35 2018
@@ -99,7 +99,8 @@ class RecordType(Type):
                             ' '.join(map(getField, self.fields)))
 
     def getTypedefDef(self, name, printer):
-        def getField((i, t)):
+        def getField(it):
+            i, t = it
             if t.isBitField():
                 if t.isPaddingBitField():
                     return '%s : 0;'%(printer.getTypeName(t),)




More information about the cfe-commits mailing list