X7ROOT File Manager
Current Path:
/opt/hc_python/lib/python3.12/site-packages/greenlet
opt
/
hc_python
/
lib
/
python3.12
/
site-packages
/
greenlet
/
??
..
??
CObjects.cpp
(3.57 KB)
??
PyGreenlet.cpp
(27.52 KB)
??
PyGreenlet.hpp
(1.43 KB)
??
PyGreenletUnswitchable.cpp
(4.06 KB)
??
PyModule.cpp
(8.59 KB)
??
TBrokenGreenlet.cpp
(1021 B)
??
TExceptionState.cpp
(1.33 KB)
??
TGreenlet.cpp
(25.62 KB)
??
TGreenlet.hpp
(28.58 KB)
??
TGreenletGlobals.cpp
(3.84 KB)
??
TMainGreenlet.cpp
(3.51 KB)
??
TPythonState.cpp
(19.15 KB)
??
TStackState.cpp
(7.21 KB)
??
TThreadState.hpp
(23.34 KB)
??
TThreadStateCreator.hpp
(2.7 KB)
??
TThreadStateDestroy.cpp
(7.99 KB)
??
TUserGreenlet.cpp
(23.76 KB)
??
__init__.py
(1.41 KB)
??
__pycache__
??
_greenlet.cpython-312-x86_64-linux-gnu.so
(1.32 MB)
??
greenlet.cpp
(10.83 KB)
??
greenlet.h
(4.64 KB)
??
greenlet_allocator.hpp
(1.79 KB)
??
greenlet_compiler_compat.hpp
(4.24 KB)
??
greenlet_cpython_compat.hpp
(3.25 KB)
??
greenlet_exceptions.hpp
(4.4 KB)
??
greenlet_internal.hpp
(2.7 KB)
??
greenlet_msvc_compat.hpp
(3.12 KB)
??
greenlet_refs.hpp
(37.17 KB)
??
greenlet_slp_switch.hpp
(3.22 KB)
??
greenlet_thread_support.hpp
(867 B)
??
platform
??
slp_platformselect.h
(3.87 KB)
??
tests
Editing: greenlet_allocator.hpp
#ifndef GREENLET_ALLOCATOR_HPP #define GREENLET_ALLOCATOR_HPP #define PY_SSIZE_T_CLEAN #include <Python.h> #include <memory> #include "greenlet_compiler_compat.hpp" #include "greenlet_cpython_compat.hpp" namespace greenlet { // This allocator is stateless; all instances are identical. // It can *ONLY* be used when we're sure we're holding the GIL // (Python's allocators require the GIL). template <class T> struct PythonAllocator : public std::allocator<T> { PythonAllocator(const PythonAllocator& UNUSED(other)) : std::allocator<T>() { } PythonAllocator(const std::allocator<T> other) : std::allocator<T>(other) {} template <class U> PythonAllocator(const std::allocator<U>& other) : std::allocator<T>(other) { } PythonAllocator() : std::allocator<T>() {} T* allocate(size_t number_objects, const void* UNUSED(hint)=0) { void* p; if (number_objects == 1) { #ifdef Py_GIL_DISABLED p = PyMem_Malloc(sizeof(T) * number_objects); #else p = PyObject_Malloc(sizeof(T)); #endif } else { p = PyMem_Malloc(sizeof(T) * number_objects); } return static_cast<T*>(p); } void deallocate(T* t, size_t n) { void* p = t; if (n == 1) { #ifdef Py_GIL_DISABLED PyMem_Free(p); #else PyObject_Free(p); #endif } else { PyMem_Free(p); } } // This member is deprecated in C++17 and removed in C++20 template< class U > struct rebind { typedef PythonAllocator<U> other; }; }; } #endif
Upload File
Create Folder