[Lldb-commits] [PATCH] D67184: [Python] Implement __next__ for value_iter
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 4 11:59:01 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL370954: [Python] Implement __next__ for value_iter (authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D67184?vs=218726&id=218764#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67184/new/
https://reviews.llvm.org/D67184
Files:
lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
lldb/trunk/scripts/Python/python-extensions.swig
Index: lldb/trunk/scripts/Python/python-extensions.swig
===================================================================
--- lldb/trunk/scripts/Python/python-extensions.swig
+++ lldb/trunk/scripts/Python/python-extensions.swig
@@ -946,13 +946,16 @@
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
if self.index >= self.length:
raise StopIteration()
child_sbvalue = self.sbvalue.GetChildAtIndex(self.index)
self.index += 1
return value(child_sbvalue)
+ def next(self):
+ return self.__next__()
+
def __init__(self,value):
self.index = 0
self.sbvalue = value
Index: lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
@@ -169,6 +169,13 @@
self.assertTrue(int(lldb.value(frame0.FindVariable('sinthex')))
== -526164208, 'sinthex == -526164208')
+ # Check value_iter works correctly.
+ for v in [
+ lldb.value(frame0.FindVariable('uinthex')),
+ lldb.value(frame0.FindVariable('sinthex'))
+ ]:
+ self.assertTrue(v)
+
self.assertTrue(
frame0.FindVariable('uinthex').GetValueAsUnsigned() == 3768803088,
'unsigned uinthex == 3768803088')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67184.218764.patch
Type: text/x-patch
Size: 1544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190904/43d15ff4/attachment.bin>
More information about the lldb-commits
mailing list