static PyObject* profiler_disable(ProfilerObject *self, PyObject* noarg) { self->flags &= ~POF_ENABLED; PyEval_SetProfile(NULL, NULL); flush_unmatched(self); if (pending_exception(self)) return NULL; Py_INCREF(Py_None); return Py_None; }
void Jump_Environment::delete_active() { // For starters, it's no longer the current exception. f_active_exception->unmake_current(); // We normally delete the current exception when it's enclosing // environment is destructed, UNLESS the same exception is being // rethrown to the handler above. g_jump_env_stack points to // the Jump_Environment that is unwinding. if (f_active_exception->f_temporary && (g_jump_env_stack == NULL || f_active_exception != pending_exception())) { // If there's one pending we created and a current one, we are going // to have to move the pending one down on our stack after // deleting the current one, so we need to remember where it ends. // If the pending exception == the current one, then we're just // returning to the scope of a previous exception. if (g_jump_env_stack != NULL && pending_exception() != NULL && pending_exception()->f_temporary && pending_exception() != Exception::g_current_exception) { // The length() method is only valid here! int length = pending_exception()->length(); delete f_active_exception; Exception::relocate (&g_jump_env_stack->f_active_exception, length); } else // Just delete it -- no move necessary. { delete f_active_exception; } } }
bool has_pending_exception() const { return pending_exception() != NULL; }