[PATCH] D56250: python compat - iterator protocol
Michael Platings via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 3 06:29:22 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:403
+ if sys.version_info.major == 2:
+ next == __next__
+
----------------
`==` should be `=`
================
Comment at: utils/gdb-scripts/prettyprinters.py:84
+ if sys.version_info.major == 2:
+ __next__ = next
----------------
Should be `next = __next__`
Or don't make this change at all as the code should already work with Python 3.
================
Comment at: utils/gdb-scripts/prettyprinters.py:90
+ if sys.version_info.major == 2:
+ __next__ = next
----------------
This line is just wrong in the original. It creates a variable `__next__` that is set to the built in `next` function. It serves no use and should be deleted.
================
Comment at: utils/gdb-scripts/prettyprinters.py:175
- def next(self):
+ def __next__(self):
if self.cur == self.end:
----------------
I see at line 183:
`__next__ = next`
which would be broken by this change. I suggest not making this change as the code should already work for Python 3.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56250/new/
https://reviews.llvm.org/D56250
More information about the llvm-commits
mailing list