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/CObjects.cpp

#ifndef COBJECTS_CPP
#define COBJECTS_CPP
/*****************************************************************************
 * C interface
 *
 * These are exported using the CObject API
 */
#ifdef __clang__
#    pragma clang diagnostic push
#    pragma clang diagnostic ignored "-Wunused-function"
#endif

#include "greenlet_exceptions.hpp"

#include "greenlet_internal.hpp"
#include "greenlet_refs.hpp"


#include "TThreadStateDestroy.cpp"

#include "PyGreenlet.hpp"

using greenlet::PyErrOccurred;
using greenlet::Require;



extern "C" {
static PyGreenlet*
PyGreenlet_GetCurrent(void)
{
    return GET_THREAD_STATE().state().get_current().relinquish_ownership();
}

static int
PyGreenlet_SetParent(PyGreenlet* g, PyGreenlet* nparent)
{
    return green_setparent((PyGreenlet*)g, (PyObject*)nparent, NULL);
}

static PyGreenlet*
PyGreenlet_New(PyObject* run, PyGreenlet* parent)
{
    using greenlet::refs::NewDictReference;
    // In the past, we didn't use green_new and green_init, but that
    // was a maintenance issue because we duplicated code. This way is
    // much safer, but slightly slower. If that's a problem, we could
    // refactor green_init to separate argument parsing from initialization.
    OwnedGreenlet g = OwnedGreenlet::consuming(green_new(&PyGreenlet_Type, nullptr, nullptr));
    if (!g) {
        return NULL;
    }

    try {
        NewDictReference kwargs;
        if (run) {
            kwargs.SetItem(mod_globs->str_run, run);
        }
        if (parent) {
            kwargs.SetItem("parent", (PyObject*)parent);
        }

        Require(green_init(g.borrow(), mod_globs->empty_tuple, kwargs.borrow()));
    }
    catch (const PyErrOccurred&) {
        return nullptr;
    }

    return g.relinquish_ownership();
}

static PyObject*
PyGreenlet_Switch(PyGreenlet* self, PyObject* args, PyObject* kwargs)
{
    if (!PyGreenlet_Check(self)) {
        PyErr_BadArgument();
        return NULL;
    }

    if (args == NULL) {
        args = mod_globs->empty_tuple;
    }

    if (kwargs == NULL || !PyDict_Check(kwargs)) {
        kwargs = NULL;
    }

    return green_switch(self, args, kwargs);
}

static PyObject*
PyGreenlet_Throw(PyGreenlet* self, PyObject* typ, PyObject* val, PyObject* tb)
{
    if (!PyGreenlet_Check(self)) {
        PyErr_BadArgument();
        return nullptr;
    }
    try {
        PyErrPieces err_pieces(typ, val, tb);
        return internal_green_throw(self, err_pieces).relinquish_ownership();
    }
    catch (const PyErrOccurred&) {
        return nullptr;
    }
}



static int
Extern_PyGreenlet_MAIN(PyGreenlet* self)
{
    if (!PyGreenlet_Check(self)) {
        PyErr_BadArgument();
        return -1;
    }
    return self->pimpl->main();
}

static int
Extern_PyGreenlet_ACTIVE(PyGreenlet* self)
{
    if (!PyGreenlet_Check(self)) {
        PyErr_BadArgument();
        return -1;
    }
    return self->pimpl->active();
}

static int
Extern_PyGreenlet_STARTED(PyGreenlet* self)
{
    if (!PyGreenlet_Check(self)) {
        PyErr_BadArgument();
        return -1;
    }
    return self->pimpl->started();
}

static PyGreenlet*
Extern_PyGreenlet_GET_PARENT(PyGreenlet* self)
{
    if (!PyGreenlet_Check(self)) {
        PyErr_BadArgument();
        return NULL;
    }
    // This can return NULL even if there is no exception
    return self->pimpl->parent().acquire();
}
} // extern C.

/** End C API ****************************************************************/
#ifdef __clang__
#    pragma clang diagnostic pop
#endif


#endif

SILENT KILLER Tool