File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22// Distributed under the Boost Software License, Version 1.0. (See
33// accompanying file LICENSE_1_0.txt or copy at
44// http://www.boost.org/LICENSE_1_0.txt)
5+ //
6+ // Credits:
7+ // Andreas Kl\:ockner for fixing increment() to handle
8+ // error conditions.
59
610#include < boost/python/object.hpp>
711#include < boost/python/handle.hpp>
@@ -27,6 +31,8 @@ void stl_input_iterator_impl::increment()
2731{
2832 this ->ob_ = boost::python::handle<>(
2933 boost::python::allow_null (PyIter_Next (this ->it_ .ptr ())));
34+ if (PyErr_Occurred ())
35+ throw boost::python::error_already_set ();
3036}
3137
3238bool stl_input_iterator_impl::equal (stl_input_iterator_impl const &that) const
Original file line number Diff line number Diff line change 12123
13134
14145
15+ >>> def generator():
16+ ... yield 1
17+ ... yield 2
18+ ... raise RuntimeError, "oops"
19+ >>> try:
20+ ... x.assign(iter(generator()))
21+ ... print "NOT OK"
22+ ... except RuntimeError:
23+ ... print "OK"
24+ OK
1525'''
1626def run (args = None ):
1727 import sys
You can’t perform that action at this time.
0 commit comments