[PATCH] D68138: [utils] Fix incompatibility of bisect[-skip-count] with Python 3

Mikhail Maltsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 27 06:21:35 PDT 2019


miyuki created this revision.
miyuki added reviewers: greened, michaelplatings, gottesmm.
Herald added a project: LLVM.

This change replaces the print statements with print function calls
and also replaces the '/' operator (which is integer division in Py2,
but becomes floating point division in Py3) with the '//' operator
which has the same semantics in Py2 and Py3.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68138

Files:
  llvm/utils/bisect
  llvm/utils/bisect-skip-count


Index: llvm/utils/bisect-skip-count
===================================================================
--- llvm/utils/bisect-skip-count
+++ llvm/utils/bisect-skip-count
@@ -52,10 +52,10 @@
 
 last = None
 while start != end and start != end-1:
-    count = start + (end - start)/2
+    count = start + (end - start)//2
     print("Visiting Skip: %d with (Start, End) = (%d,%d)" % (count, start, end))
     cmd = [x % {'skip':count, 'count':-1} for x in args.command]
-    print cmd
+    print(cmd)
     try:
         result = subprocess.call(cmd, shell=args.shell, timeout=args.timeout)
         if result == 0:
@@ -75,10 +75,10 @@
 print("Start: %d" % start)
 print("End: %d" % end)
 while start != end and start != end-1:
-    count = start + (end - start)/2
+    count = start + (end - start)//2
     print("Visiting Count: %d with (Start, End) = (%d,%d)" % (count, start, end))
     cmd = [x % {'count':count, 'skip':firstcount } for x in args.command]
-    print cmd
+    print(cmd)
     try:
         result = subprocess.call(cmd, shell=args.shell, timeout=args.timeout)
         if result == 0:
Index: llvm/utils/bisect
===================================================================
--- llvm/utils/bisect
+++ llvm/utils/bisect
@@ -34,10 +34,10 @@
 
 last = None
 while start != end and start != end-1:
-    count = start + (end - start)/2
+    count = start + (end - start)//2
     print("Visiting Count: %d with (Start, End) = (%d,%d)" % (count, start, end))
     cmd = [x % {'count':count} for x in args.command]
-    print cmd
+    print(cmd)
     result = subprocess.call(cmd)
     if result == 0:
         print("    PASSES! Setting start to count")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68138.222160.patch
Type: text/x-patch
Size: 1668 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190927/02f43a39/attachment.bin>


More information about the llvm-commits mailing list