diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2017-09-06 01:26:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-06 01:26:16 (GMT) |
commit | 76d5abc8684bac4f2fc7cccfe2cd940923357351 (patch) | |
tree | 4ae6a3bd88bef1266a8d9723c589f925d90bf848 /Include/pystate.h | |
parent | 501b324d3a940d26e0021a38aae8d896a30fbcff (diff) | |
download | cpython-76d5abc8684bac4f2fc7cccfe2cd940923357351.zip cpython-76d5abc8684bac4f2fc7cccfe2cd940923357351.tar.gz cpython-76d5abc8684bac4f2fc7cccfe2cd940923357351.tar.bz2 |
bpo-30860: Consolidate stateful runtime globals. (#2594)
* group the (stateful) runtime globals into various topical structs
* consolidate the topical structs under a single top-level _PyRuntimeState struct
* add a check-c-globals.py script that helps identify runtime globals
Other globals are excluded (see globals.txt and check-c-globals.py).
Diffstat (limited to 'Include/pystate.h')
-rw-r--r-- | Include/pystate.h | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/Include/pystate.h b/Include/pystate.h index 8a92f3e..90081c5 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -29,9 +29,10 @@ typedef struct { int use_hash_seed; unsigned long hash_seed; int _disable_importlib; /* Needed by freeze_importlib */ + char *allocator; } _PyCoreConfig; -#define _PyCoreConfig_INIT {0, -1, 0, 0} +#define _PyCoreConfig_INIT {0, -1, 0, 0, NULL} /* Placeholders while working on the new configuration API * @@ -57,6 +58,19 @@ typedef struct _is { PyObject *builtins; PyObject *importlib; + /* Used in Python/sysmodule.c. */ + int check_interval; + PyObject *warnoptions; + PyObject *xoptions; + + /* Used in Modules/_threadmodule.c. */ + long num_threads; + /* Support for runtime thread stack size tuning. + A value of 0 means using the platform's default stack size + or the size specified by the THREAD_STACK_SIZE macro. */ + /* Used in Python/thread.c. */ + size_t pythread_stacksize; + PyObject *codec_search_path; PyObject *codec_search_cache; PyObject *codec_error_registry; @@ -185,9 +199,6 @@ typedef struct _ts { #endif -#ifndef Py_LIMITED_API -PyAPI_FUNC(void) _PyInterpreterState_Init(void); -#endif /* !Py_LIMITED_API */ PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void); PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *); PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *); @@ -246,7 +257,7 @@ PyAPI_FUNC(int) PyThreadState_SetAsyncExc(unsigned long, PyObject *); /* Assuming the current thread holds the GIL, this is the PyThreadState for the current thread. */ #ifdef Py_BUILD_CORE -PyAPI_DATA(_Py_atomic_address) _PyThreadState_Current; +# define _PyThreadState_Current _PyRuntime.gilstate.tstate_current # define PyThreadState_GET() \ ((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) #else @@ -301,10 +312,6 @@ PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE); PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void); #ifndef Py_LIMITED_API -/* Issue #26558: Flag to disable PyGILState_Check(). - If set to non-zero, PyGILState_Check() always return 1. */ -PyAPI_DATA(int) _PyGILState_check_enabled; - /* Helper/diagnostic function - return 1 if the current thread currently holds the GIL, 0 otherwise. @@ -340,11 +347,6 @@ PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_); #endif -/* hook for PyEval_GetFrame(), requested for Psyco */ -#ifndef Py_LIMITED_API -PyAPI_DATA(PyThreadFrameGetter) _PyThreadState_GetFrame; -#endif - #ifdef __cplusplus } #endif |