PHP 8.3.31
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 2026-06-11 06:30:31
Edit Download
tests DIR
- drwxr-xr-x 2026-06-11 06:30:31
Edit Download
- drwxr-xr-x 2026-06-11 06:30:31
Edit Download
3.57 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
10.83 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
4.64 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
1.79 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
4.24 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
3.25 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
4.40 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
2.70 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
3.12 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
37.17 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
3.22 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
867 B lrw-r--r-- 2026-06-11 06:30:31
Edit Download
27.52 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
1.43 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
4.06 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
8.59 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
3.87 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
1021 B lrw-r--r-- 2026-06-11 06:30:31
Edit Download
1.33 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
25.62 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
28.58 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
3.84 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
3.51 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
19.15 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
7.21 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
23.34 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
2.70 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
7.99 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
23.76 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
1.32 MB lrwxr-xr-x 2026-06-11 06:30:31
Edit Download
1.41 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download

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