Merge branch 'python3-iterator' into '0.3.2'

Add __next__ method to follow python3 iterator protocol

See merge request pykd/pykd!3
This commit is contained in:
ussrhero 2018-04-21 09:13:25 -04:00
commit 7fa4ec351a

View File

@ -796,7 +796,11 @@ BOOST_PYTHON_MODULE( pykd )
python::class_<TargetHeapIterator>("targetHeapIterator", "iterator for typedVar array", python::no_init) python::class_<TargetHeapIterator>("targetHeapIterator", "iterator for typedVar array", python::no_init)
.def("__iter__", &TargetHeapIterator::self) .def("__iter__", &TargetHeapIterator::self)
.def("__len__", &TargetHeapIterator::length) .def("__len__", &TargetHeapIterator::length)
#if PY_VERSION_HEX < 0x03000000
.def("next", &TargetHeapIterator::next) .def("next", &TargetHeapIterator::next)
#else
.def("__next__", &TargetHeapIterator::next)
#endif
; ;
python::class_<kdlib::TargetHeap, kdlib::TargetHeapPtr, boost::noncopyable>("targetHeap", "Class representing heap in the target process", python::no_init ) python::class_<kdlib::TargetHeap, kdlib::TargetHeapPtr, boost::noncopyable>("targetHeap", "Class representing heap in the target process", python::no_init )
@ -960,7 +964,11 @@ BOOST_PYTHON_MODULE( pykd )
python::class_<TypedVarIterator>("typedVarIterator", "iterator for typedVar array", python::no_init) python::class_<TypedVarIterator>("typedVarIterator", "iterator for typedVar array", python::no_init)
.def("__iter__", &TypedVarIterator::self) .def("__iter__", &TypedVarIterator::self)
#if PY_VERSION_HEX < 0x03000000
.def("next", &TypedVarIterator::next) .def("next", &TypedVarIterator::next)
#else
.def("__next__", &TypedVarIterator::next)
#endif
; ;
python::class_<kdlib::TypedVar, kdlib::TypedVarPtr, python::bases<kdlib::NumBehavior>, boost::noncopyable >("typedVar", python::class_<kdlib::TypedVar, kdlib::TypedVarPtr, python::bases<kdlib::NumBehavior>, boost::noncopyable >("typedVar",