From 81a7be3fa22c983209cc0ffb3537b92b0370f83c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 14 Apr 2020 15:14:01 +0200 Subject: 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. --- Python/codecs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Python/codecs.c') diff --git a/Python/codecs.c b/Python/codecs.c index 66919856ce..32cc110d8e 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -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) -- cgit v1.2.1