mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
gh-108867: Add PyThreadState_GetUnchecked() function (#108870)
Add PyThreadState_GetUnchecked() function: similar to PyThreadState_Get(), but don't issue a fatal error if it is NULL. The caller is responsible to check if the result is NULL. Previously, this function was private and known as _PyThreadState_UncheckedGet().
This commit is contained in:
parent
6ab6040054
commit
d73501602f
10 changed files with 34 additions and 8 deletions
|
@ -6,6 +6,7 @@
|
|||
#include "pycore_pathconfig.h" // _PyPathConfig_ReadGlobal()
|
||||
#include "pycore_pyerrors.h" // _PyErr_WriteUnraisableMsg()
|
||||
#include "pycore_pymem.h" // _PyMem_RawWcsdup()
|
||||
#include "pycore_pystate.h" // _PyThreadState_GET()
|
||||
|
||||
#include "marshal.h" // PyMarshal_ReadObjectFromString
|
||||
#include "osdefs.h" // DELIM
|
||||
|
@ -821,7 +822,7 @@ _PyConfig_InitPathConfig(PyConfig *config, int compute_path_config)
|
|||
return status;
|
||||
}
|
||||
|
||||
if (!_PyThreadState_UncheckedGet()) {
|
||||
if (!_PyThreadState_GET()) {
|
||||
return PyStatus_Error("cannot calculate path configuration without GIL");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue