[C++-sig] [patch] STL input iterator does not propagate exceptions

Andreas Klöckner lists at informa.tiker.net
Fri Dec 21 06:23:04 CET 2007


Hi all,

I get a segfault if I use boost::python::stl_input_iterator from C++, and the 
Python code (a generator or some such) that I iterate off of raises an 
exception (such as KeyboardInterrupt, which makes it easy to test). This is 
because a NULL return from PyIter_Next is always interpreted as "end of 
list", and not as the error that it may well be.

Attached patch fixes this.

Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bpl-stl-iterator-prop-ex-2007-12-20.patch
Type: text/x-diff
Size: 635 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20071221/b79f35f0/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20071221/b79f35f0/attachment.pgp>


More information about the Cplusplus-sig mailing list