[PATCH] D55204: Python 2/3 compat - div

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 18 00:42:36 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC349455: Portable Python script across Python version (authored by serge_sans_paille, committed by ).
Herald added a subscriber: cfe-commits.

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55204/new/

https://reviews.llvm.org/D55204

Files:
  utils/ABITest/TypeGen.py
  utils/analyzer/CmpRuns.py


Index: utils/ABITest/TypeGen.py
===================================================================
--- utils/ABITest/TypeGen.py
+++ utils/ABITest/TypeGen.py
@@ -1,5 +1,5 @@
 """Flexible enumeration of C types."""
-from __future__ import print_function
+from __future__ import division, print_function
 
 from Enumeration import *
 
@@ -235,7 +235,7 @@
 
 # Compute the number of combinations (n choose k)
 def num_combinations(n, k): 
-    return fact(n) / (fact(k) * fact(n - k))
+    return fact(n) // (fact(k) * fact(n - k))
 
 # Enumerate the combinations choosing k elements from the list of values
 def combinations(values, k):
Index: utils/analyzer/CmpRuns.py
===================================================================
--- utils/analyzer/CmpRuns.py
+++ utils/analyzer/CmpRuns.py
@@ -25,7 +25,7 @@
     diff = compareResults(resultsA, resultsB)
 
 """
-from __future__ import print_function
+from __future__ import division, print_function
 
 from collections import defaultdict
 
@@ -308,7 +308,7 @@
             "mean": sum(values) / len(values),
             "90th %tile": computePercentile(values, 0.9),
             "95th %tile": computePercentile(values, 0.95),
-            "median": sorted(values)[len(values) / 2],
+            "median": sorted(values)[len(values) // 2],
             "total": sum(values)
         }
     return combined_stats


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55204.178612.patch
Type: text/x-patch
Size: 1369 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181218/4da1147c/attachment.bin>


More information about the cfe-commits mailing list