Boost logo

Boost Users :

Subject: Re: [Boost-users] [python] intercepting uncaught exceptions
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-03-01 11:40:46


On Tue, Mar 1, 2011 at 2:13 AM, Gennadiy Rozental <rogeeff_at_[hidden]> wrote:
> Juraj Ivančić <juraj.ivancic <at> gmail.com> writes:
>
>> Boost.Python throws error_already_set exception in case
>> PyErr_Occurred() is true, and here PyErr functions kick in. Perhaps
>> PyErr_Fetch() and PyErr_Restore() are what you're looking for?
>
> These I am using already. The problem is that I am running different pieces of
> embedded code in different "execution environments" with different global and
> local dictionaries associated with different Boost.Python object being executed.
>
> I need an ability to treat an error slightly differently depending on which
> "environment" an error occurred in. Thus I need to know what was the global
> dictionary at the time (or something similar identifying the "environment").
>
> I hoped I can attach something to the traceback object, but I need to somehow
> intercept it.

This sounds like a general python/C question; the fact that
Boost.Python is throwing an exception is a minor detail in the picture
that doesn't affect the answer. You might try asking on the regular
Python user's list.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net