PHP 8.2.30
Preview: TExceptionState.cpp Size: 1.33 KB
/opt/hc_python/lib64/python3.12/site-packages/greenlet/TExceptionState.cpp

#ifndef GREENLET_EXCEPTION_STATE_CPP
#define GREENLET_EXCEPTION_STATE_CPP

#include <Python.h>
#include "TGreenlet.hpp"

namespace greenlet {


ExceptionState::ExceptionState()
{
    this->clear();
}

void ExceptionState::operator<<(const PyThreadState *const tstate) noexcept
{
    this->exc_info = tstate->exc_info;
    this->exc_state = tstate->exc_state;
}

void ExceptionState::operator>>(PyThreadState *const tstate) noexcept
{
    tstate->exc_state = this->exc_state;
    tstate->exc_info =
        this->exc_info ? this->exc_info : &tstate->exc_state;
    this->clear();
}

void ExceptionState::clear() noexcept
{
    this->exc_info = nullptr;
    this->exc_state.exc_value = nullptr;
#if !GREENLET_PY311
    this->exc_state.exc_type = nullptr;
    this->exc_state.exc_traceback = nullptr;
#endif
    this->exc_state.previous_item = nullptr;
}

int ExceptionState::tp_traverse(visitproc visit, void* arg) noexcept
{
    Py_VISIT(this->exc_state.exc_value);
#if !GREENLET_PY311
    Py_VISIT(this->exc_state.exc_type);
    Py_VISIT(this->exc_state.exc_traceback);
#endif
    return 0;
}

void ExceptionState::tp_clear() noexcept
{
    Py_CLEAR(this->exc_state.exc_value);
#if !GREENLET_PY311
    Py_CLEAR(this->exc_state.exc_type);
    Py_CLEAR(this->exc_state.exc_traceback);
#endif
}


}; // namespace greenlet

#endif // GREENLET_EXCEPTION_STATE_CPP

Directory Contents

Dirs: 3 × Files: 31

Name Size Perms Modified Actions
platform DIR
- drwxr-xr-x 2025-12-03 08:02:54
Edit Download
tests DIR
- drwxr-xr-x 2025-12-03 08:02:54
Edit Download
- drwxr-xr-x 2025-12-03 08:02:54
Edit Download
3.43 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
10.74 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
4.64 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
2.55 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
4.24 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
4.05 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
4.40 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
2.65 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
2.91 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
33.63 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
3.12 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
867 B lrw-r--r-- 2025-12-03 08:02:54
Edit Download
23.63 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
1.43 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
4.27 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
8.39 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
3.87 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
1021 B lrw-r--r-- 2025-12-03 08:02:54
Edit Download
1.33 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
25.13 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
27.85 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
3.19 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
3.20 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
15.60 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
7.21 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
18.68 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
2.55 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
7.98 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
23.00 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download
1.38 MB lrwxr-xr-x 2025-12-03 08:02:54
Edit Download
1.68 KB lrw-r--r-- 2025-12-03 08:02:54
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).