mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-40268: Add _PyInterpreterState_GetConfig() (GH-19492)
Don't access PyInterpreterState.config member directly anymore, but use new functions: * _PyInterpreterState_GetConfig() * _PyInterpreterState_SetConfig() * _Py_GetConfig()
This commit is contained in:
parent
14d5331eb5
commit
da7933ecc3
19 changed files with 90 additions and 64 deletions
|
@ -790,7 +790,7 @@ _PyInterpreterState_ClearModules(PyInterpreterState *interp)
|
|||
void
|
||||
PyThreadState_Clear(PyThreadState *tstate)
|
||||
{
|
||||
int verbose = tstate->interp->config.verbose;
|
||||
int verbose = _PyInterpreterState_GetConfig(tstate->interp)->verbose;
|
||||
|
||||
if (verbose && tstate->frame != NULL) {
|
||||
/* bpo-20526: After the main thread calls
|
||||
|
@ -1808,6 +1808,30 @@ _PyInterpreterState_SetEvalFrameFunc(PyInterpreterState *interp,
|
|||
interp->eval_frame = eval_frame;
|
||||
}
|
||||
|
||||
|
||||
const PyConfig*
|
||||
_PyInterpreterState_GetConfig(PyInterpreterState *interp)
|
||||
{
|
||||
return &interp->config;
|
||||
}
|
||||
|
||||
|
||||
PyStatus
|
||||
_PyInterpreterState_SetConfig(PyInterpreterState *interp,
|
||||
const PyConfig *config)
|
||||
{
|
||||
return _PyConfig_Copy(&interp->config, config);
|
||||
}
|
||||
|
||||
|
||||
const PyConfig*
|
||||
_Py_GetConfig(void)
|
||||
{
|
||||
assert(PyGILState_Check());
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
return _PyInterpreterState_GetConfig(tstate->interp);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue