[PATCH] D56250: python compat - iterator protocol

Michael Platings via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 3 07:24:30 PST 2019


michaelplatings requested changes to this revision.
michaelplatings added inline comments.
This revision now requires changes to proceed.


================
Comment at: bindings/python/llvm/core.py:248
             else:
-                self.function = self.function.next
+                self.function = self.function.__next__
             return result
----------------
I had a poke around this file and found that `self.function.next` refers to the `next` //property// in the Function class. I don't think the Function class should be changed as it isn't intended to be an iterator, and therefore the change to this line should be reverted.


================
Comment at: bindings/python/llvm/core.py:319
             else:
-                self.bb = self.bb.next
+                self.bb = self.bb.__next__
             return result
----------------
Likewise, `self.bb.next` is a property of BasicBlock.
The change to this line should be reverted.


================
Comment at: bindings/python/llvm/core.py:399
             else:
-                self.inst = self.inst.next
+                self.inst = self.inst.__next__
             return result
----------------
Likewise, `self.inst.next` is a property of Instruction.
The change to this line should be reverted.


================
Comment at: bindings/python/llvm/tests/test_core.py:101
         while f.name != "f6":
-            f = f.next
+            f = f.__next__
 
----------------
I think this refers to the `next` property of the Function class in core.py. The change on this line should be reverted.


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

https://reviews.llvm.org/D56250





More information about the llvm-commits mailing list