1#ifndef GREENLET_EXCEPTION_STATE_CPP
2#define GREENLET_EXCEPTION_STATE_CPP
5#include "TGreenlet.hpp"
10ExceptionState::ExceptionState()
15void ExceptionState::operator<<(
const PyThreadState *
const tstate)
noexcept
17 this->exc_info = tstate->exc_info;
18 this->exc_state = tstate->exc_state;
21void ExceptionState::operator>>(PyThreadState *
const tstate)
noexcept
23 tstate->exc_state = this->exc_state;
25 this->exc_info ? this->exc_info : &tstate->exc_state;
29void ExceptionState::clear() noexcept
31 this->exc_info =
nullptr;
32 this->exc_state.exc_value =
nullptr;
34 this->exc_state.exc_type =
nullptr;
35 this->exc_state.exc_traceback =
nullptr;
37 this->exc_state.previous_item =
nullptr;
40int ExceptionState::tp_traverse(visitproc visit,
void* arg)
noexcept
42 Py_VISIT(this->exc_state.exc_value);
44 Py_VISIT(this->exc_state.exc_type);
45 Py_VISIT(this->exc_state.exc_traceback);
50void ExceptionState::tp_clear() noexcept
52 Py_CLEAR(this->exc_state.exc_value);
54 Py_CLEAR(this->exc_state.exc_type);
55 Py_CLEAR(this->exc_state.exc_traceback);