[C++-sig] BPL v2 and Exceptions
greg Landrum
greglandrum at mindspring.com
Wed Oct 16 00:21:13 CEST 2002
At 02:53 PM 10/15/2002, you wrote:
>Greg Landrum <greglandrum at earthlink.net> writes:
>
> > void throw_arg_error()
> > {
> > std::cerr << "Ach!\n";
> > python::throw_argument_error();
>
>This is part of your problem. You shouldn't be using
>throw_argument_error(). If that's in the docs, it shouldn't be. It's
>not. Why are you using it?
That's a pretty good question. The answer is something along the lines of
"I've been flailing at this for a couple hours and that managed to diffuse
in at one point." The actual call itself isn't terribly important, the
next case was more what I wanted to be doing anyway:
> >
> > // A helper function for dealing with errors. Throw a Python ValueError
> > void throw_value_error(const std::string err)
> > {
> > std::cerr << "Ach!\n";
> > PyErr_SetString(PyExc_ValueError, err.c_str());
> > python::throw_error_already_set();
>
>This one's OK.
>It's mostly not stupid. I'm not sure why it would be aborting. Do the
>tests pass on your system? To find out, go to
>$BOOST_ROOT/libs/python/test, and:
>
> bjam -sTOOLS=gcc test
>If any tests fail, it will be apparent.
I ran the tests after installation and everything looked good. I just
tried them again to be sure and they still all pass. Do any of the tests
actually stress the PyErr_SetString method of throwing exceptions? (I ask
because a quick grep of the test source makes me think the answer is no).
-greg
More information about the Cplusplus-sig
mailing list