mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
bpo-40268: Rename _PyInterpreterState_GET_UNSAFE() (GH-19509)
Rename _PyInterpreterState_GET_UNSAFE() to _PyInterpreterState_GET() for consistency with _PyThreadState_GET() and to have a shorter name (help to fit into 80 columns). Add also "assert(tstate != NULL);" to the function.
This commit is contained in:
parent
4a3fe08353
commit
81a7be3fa2
23 changed files with 53 additions and 52 deletions
|
@ -33,7 +33,7 @@ static int _PyCodecRegistry_Init(void); /* Forward */
|
|||
|
||||
int PyCodec_Register(PyObject *search_function)
|
||||
{
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE();
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
if (interp->codec_search_path == NULL && _PyCodecRegistry_Init())
|
||||
goto onError;
|
||||
if (search_function == NULL) {
|
||||
|
@ -105,7 +105,7 @@ PyObject *_PyCodec_Lookup(const char *encoding)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE();
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ int _PyCodec_Forget(const char *encoding)
|
|||
PyObject *v;
|
||||
int result;
|
||||
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE();
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
if (interp->codec_search_path == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -621,7 +621,7 @@ PyObject *_PyCodec_DecodeText(PyObject *object,
|
|||
Return 0 on success, -1 on error */
|
||||
int PyCodec_RegisterError(const char *name, PyObject *error)
|
||||
{
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE();
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
if (interp->codec_search_path == NULL && _PyCodecRegistry_Init())
|
||||
return -1;
|
||||
if (!PyCallable_Check(error)) {
|
||||
|
@ -639,7 +639,7 @@ PyObject *PyCodec_LookupError(const char *name)
|
|||
{
|
||||
PyObject *handler = NULL;
|
||||
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE();
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
if (interp->codec_search_path == NULL && _PyCodecRegistry_Init())
|
||||
return NULL;
|
||||
|
||||
|
@ -1491,7 +1491,7 @@ static int _PyCodecRegistry_Init(void)
|
|||
}
|
||||
};
|
||||
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE();
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
PyObject *mod;
|
||||
|
||||
if (interp->codec_search_path != NULL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue