__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
#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)
{
if (greenlet::IsShuttingDown()) {
PyErr_SetString(PyExc_RuntimeError, "greenlet is being finalized");
return nullptr;
}
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
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| platform | Folder | 0755 |
|
|
| tests | Folder | 0755 |
|
|
| CObjects.cpp | File | 3.57 KB | 0644 |
|
| PyGreenlet.cpp | File | 27.52 KB | 0644 |
|
| PyGreenlet.hpp | File | 1.43 KB | 0644 |
|
| PyGreenletUnswitchable.cpp | File | 4.06 KB | 0644 |
|
| PyModule.cpp | File | 8.59 KB | 0644 |
|
| TBrokenGreenlet.cpp | File | 1021 B | 0644 |
|
| TExceptionState.cpp | File | 1.33 KB | 0644 |
|
| TGreenlet.cpp | File | 25.62 KB | 0644 |
|
| TGreenlet.hpp | File | 28.58 KB | 0644 |
|
| TGreenletGlobals.cpp | File | 3.84 KB | 0644 |
|
| TMainGreenlet.cpp | File | 3.51 KB | 0644 |
|
| TPythonState.cpp | File | 19.15 KB | 0644 |
|
| TStackState.cpp | File | 7.21 KB | 0644 |
|
| TThreadState.hpp | File | 23.34 KB | 0644 |
|
| TThreadStateCreator.hpp | File | 2.7 KB | 0644 |
|
| TThreadStateDestroy.cpp | File | 7.99 KB | 0644 |
|
| TUserGreenlet.cpp | File | 23.76 KB | 0644 |
|
| __init__.py | File | 1.41 KB | 0644 |
|
| _greenlet.cpython-312-x86_64-linux-gnu.so | File | 1.32 MB | 0755 |
|
| greenlet.cpp | File | 10.83 KB | 0644 |
|
| greenlet.h | File | 4.64 KB | 0644 |
|
| greenlet_allocator.hpp | File | 1.79 KB | 0644 |
|
| greenlet_compiler_compat.hpp | File | 4.24 KB | 0644 |
|
| greenlet_cpython_compat.hpp | File | 3.25 KB | 0644 |
|
| greenlet_exceptions.hpp | File | 4.4 KB | 0644 |
|
| greenlet_internal.hpp | File | 2.7 KB | 0644 |
|
| greenlet_msvc_compat.hpp | File | 3.12 KB | 0644 |
|
| greenlet_refs.hpp | File | 37.17 KB | 0644 |
|
| greenlet_slp_switch.hpp | File | 3.22 KB | 0644 |
|
| greenlet_thread_support.hpp | File | 867 B | 0644 |
|
| slp_platformselect.h | File | 3.87 KB | 0644 |
|