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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user