File indexing completed on 2025-11-19 09:50:54
0001
0002
0003
0004 #ifndef Py_PYSTATE_H
0005 #define Py_PYSTATE_H
0006 #ifdef __cplusplus
0007 extern "C" {
0008 #endif
0009
0010
0011
0012 #define MAX_CO_EXTRA_USERS 255
0013
0014 PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void);
0015 PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *);
0016 PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *);
0017
0018 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000
0019
0020
0021
0022
0023
0024
0025
0026 PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Get(void);
0027 #endif
0028
0029 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03080000
0030
0031 PyAPI_FUNC(PyObject *) PyInterpreterState_GetDict(PyInterpreterState *);
0032 #endif
0033
0034 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
0035
0036 PyAPI_FUNC(int64_t) PyInterpreterState_GetID(PyInterpreterState *);
0037 #endif
0038 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
0039
0040
0041
0042
0043 PyAPI_FUNC(int) PyState_AddModule(PyObject*, PyModuleDef*);
0044 PyAPI_FUNC(int) PyState_RemoveModule(PyModuleDef*);
0045 #endif
0046 PyAPI_FUNC(PyObject*) PyState_FindModule(PyModuleDef*);
0047
0048 PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *);
0049 PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *);
0050 PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *);
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void);
0061
0062
0063 #define PyThreadState_GET() PyThreadState_Get()
0064
0065 PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *);
0066 PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void);
0067 PyAPI_FUNC(int) PyThreadState_SetAsyncExc(unsigned long, PyObject *);
0068
0069 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000
0070
0071 PyAPI_FUNC(PyInterpreterState*) PyThreadState_GetInterpreter(PyThreadState *tstate);
0072 PyAPI_FUNC(PyFrameObject*) PyThreadState_GetFrame(PyThreadState *tstate);
0073 PyAPI_FUNC(uint64_t) PyThreadState_GetID(PyThreadState *tstate);
0074 #endif
0075
0076 typedef
0077 enum {PyGILState_LOCKED, PyGILState_UNLOCKED}
0078 PyGILState_STATE;
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102 PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void);
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112 PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE);
0113
0114
0115
0116
0117
0118
0119
0120 PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void);
0121
0122
0123 #ifndef Py_LIMITED_API
0124 # define Py_CPYTHON_PYSTATE_H
0125 # include "cpython/pystate.h"
0126 # undef Py_CPYTHON_PYSTATE_H
0127 #endif
0128
0129 #ifdef __cplusplus
0130 }
0131 #endif
0132 #endif