[C++-sig] [boost.python] PyErr_Fetch and object
Alex Mohr
amohr at pixar.com
Thu Aug 28 19:47:00 CEST 2008
> Thanks ! Actually, the lack of a check for 'type' was intentional: Even
> if an error is set, 'value' and 'traceback' may be set to NULL.
> 'type' can only be NULL if no error is set, and thus has to be handled
> special. (For example, we could throw an exception in that case, as
> calling fetch_error if no error is set is an error (or may be, if we
> make it so).
Hmm -- well, my personal preference is for it to mimic the python c api,
so if there is no error set, then all three are set to None, if there is
an error set, then type is not None, and value and traceback may or may
not be None. That's how I tried to write it.
> Of course, with that then come other function wrappers for 'restore',
> 'clear', etc.
Indeed. It would be nice to do a project that tried to wrap up all (or
as much as possible) of the python C api. That would benefit and appeal
to a wide audience, I think. Even including folks who don't use
boost.python to generate bindings.
> I'll think about a patch, if no-one else beats me to it <wink/>
:)
Alex
More information about the Cplusplus-sig
mailing list