SILENT KILLERPanel

Current Path: > > opt > hc_python > > lib > > python3.12 > site-packages > greenlet


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt/hc_python//lib//python3.12/site-packages/greenlet

NameTypeSizeLast ModifiedActions
__pycache__ Directory - -
platform Directory - -
tests Directory - -
CObjects.cpp File 3508 bytes May 23 2025 10:34:46.
PyGreenlet.cpp File 23441 bytes May 23 2025 10:34:46.
PyGreenlet.hpp File 1463 bytes May 23 2025 10:34:46.
PyGreenletUnswitchable.cpp File 4375 bytes May 23 2025 10:34:46.
PyModule.cpp File 8587 bytes May 23 2025 10:34:46.
TBrokenGreenlet.cpp File 1021 bytes May 23 2025 10:34:46.
TExceptionState.cpp File 1359 bytes May 23 2025 10:34:46.
TGreenlet.cpp File 25731 bytes May 23 2025 10:34:46.
TGreenlet.hpp File 28043 bytes May 23 2025 10:34:46.
TGreenletGlobals.cpp File 3264 bytes May 23 2025 10:34:46.
TMainGreenlet.cpp File 3276 bytes May 23 2025 10:34:46.
TPythonState.cpp File 15779 bytes May 23 2025 10:34:46.
TStackState.cpp File 7381 bytes May 23 2025 10:34:46.
TThreadState.hpp File 19131 bytes May 23 2025 10:34:46.
TThreadStateCreator.hpp File 2610 bytes May 23 2025 10:34:46.
TThreadStateDestroy.cpp File 8169 bytes May 23 2025 10:34:46.
TUserGreenlet.cpp File 23553 bytes May 23 2025 10:34:46.
__init__.py File 1723 bytes May 23 2025 10:34:46.
_greenlet.cpython-312-x86_64-linux-gnu.so File 1446128 bytes May 23 2025 10:34:46.
greenlet.cpp File 10996 bytes May 23 2025 10:34:46.
greenlet.h File 4755 bytes May 23 2025 10:34:46.
greenlet_allocator.hpp File 1582 bytes May 23 2025 10:34:46.
greenlet_compiler_compat.hpp File 4346 bytes May 23 2025 10:34:46.
greenlet_cpython_compat.hpp File 4068 bytes May 23 2025 10:34:46.
greenlet_exceptions.hpp File 4503 bytes May 23 2025 10:34:46.
greenlet_internal.hpp File 2709 bytes May 23 2025 10:34:46.
greenlet_refs.hpp File 34436 bytes May 23 2025 10:34:46.
greenlet_slp_switch.hpp File 3198 bytes May 23 2025 10:34:46.
greenlet_thread_support.hpp File 867 bytes May 23 2025 10:34:46.
slp_platformselect.h File 3841 bytes May 23 2025 10:34:46.

Reading File: //opt/hc_python//lib//python3.12/site-packages/greenlet/greenlet_exceptions.hpp

#ifndef GREENLET_EXCEPTIONS_HPP
#define GREENLET_EXCEPTIONS_HPP

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <stdexcept>
#include <string>

#ifdef __clang__
#    pragma clang diagnostic push
#    pragma clang diagnostic ignored "-Wunused-function"
#endif

namespace greenlet {

    class PyErrOccurred : public std::runtime_error
    {
    public:

        // CAUTION: In debug builds, may run arbitrary Python code.
        static const PyErrOccurred
        from_current()
        {
            assert(PyErr_Occurred());
#ifndef NDEBUG
            // This is not exception safe, and
            // not necessarily safe in general (what if it switches?)
            // But we only do this in debug mode, where we are in
            // tight control of what exceptions are getting raised and
            // can prevent those issues.

            // You can't call PyObject_Str with a pending exception.
            PyObject* typ;
            PyObject* val;
            PyObject* tb;

            PyErr_Fetch(&typ, &val, &tb);
            PyObject* typs = PyObject_Str(typ);
            PyObject* vals = PyObject_Str(val ? val : typ);
            const char* typ_msg = PyUnicode_AsUTF8(typs);
            const char* val_msg = PyUnicode_AsUTF8(vals);
            PyErr_Restore(typ, val, tb);

            std::string msg(typ_msg);
            msg += ": ";
            msg += val_msg;
            PyErrOccurred ex(msg);
            Py_XDECREF(typs);
            Py_XDECREF(vals);

            return ex;
#else
            return PyErrOccurred();
#endif
        }

        PyErrOccurred() : std::runtime_error("")
        {
            assert(PyErr_Occurred());
        }

        PyErrOccurred(const std::string& msg) : std::runtime_error(msg)
        {
            assert(PyErr_Occurred());
        }

        PyErrOccurred(PyObject* exc_kind, const char* const msg)
            : std::runtime_error(msg)
        {
            PyErr_SetString(exc_kind, msg);
        }

        PyErrOccurred(PyObject* exc_kind, const std::string msg)
            : std::runtime_error(msg)
        {
            // This copies the c_str, so we don't have any lifetime
            // issues to worry about.
            PyErr_SetString(exc_kind, msg.c_str());
        }

        PyErrOccurred(PyObject* exc_kind,
                      const std::string msg, //This is the format
                                             //string; that's not
                                             //usually safe!

                      PyObject* borrowed_obj_one, PyObject* borrowed_obj_two)
            : std::runtime_error(msg)
        {

            //This is designed specifically for the
            //``check_switch_allowed`` function.

            // PyObject_Str and PyObject_Repr are safe to call with
            // NULL pointers; they return the string "<NULL>" in that
            // case.
            // This function always returns null.
            PyErr_Format(exc_kind,
                         msg.c_str(),
                         borrowed_obj_one, borrowed_obj_two);
        }
    };

    class TypeError : public PyErrOccurred
    {
    public:
        TypeError(const char* const what)
            : PyErrOccurred(PyExc_TypeError, what)
        {
        }
        TypeError(const std::string what)
            : PyErrOccurred(PyExc_TypeError, what)
        {
        }
    };

    class ValueError : public PyErrOccurred
    {
    public:
        ValueError(const char* const what)
            : PyErrOccurred(PyExc_ValueError, what)
        {
        }
    };

    class AttributeError : public PyErrOccurred
    {
    public:
        AttributeError(const char* const what)
            : PyErrOccurred(PyExc_AttributeError, what)
        {
        }
    };

    /**
     * Calls `Py_FatalError` when constructed, so you can't actually
     * throw this. It just makes static analysis easier.
     */
    class PyFatalError : public std::runtime_error
    {
    public:
        PyFatalError(const char* const msg)
            : std::runtime_error(msg)
        {
            Py_FatalError(msg);
        }
    };

    static inline PyObject*
    Require(PyObject* p, const std::string& msg="")
    {
        if (!p) {
            throw PyErrOccurred(msg);
        }
        return p;
    };

    static inline void
    Require(const int retval)
    {
        if (retval < 0) {
            throw PyErrOccurred();
        }
    };


};
#ifdef __clang__
#    pragma clang diagnostic pop
#endif

#endif

SILENT KILLER Tool