diff options
author | Victor Stinner <vstinner@python.org> | 2020-04-14 13:14:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-14 13:14:01 (GMT) |
commit | 81a7be3fa22c983209cc0ffb3537b92b0370f83c (patch) | |
tree | c257d7143ecc60574353caa76fa2992a455ebb54 /Python/codecs.c | |
parent | 4a3fe0835310643193ea45529ab0fb45c5f8f2fd (diff) | |
download | cpython-81a7be3fa22c983209cc0ffb3537b92b0370f83c.zip cpython-81a7be3fa22c983209cc0ffb3537b92b0370f83c.tar.gz cpython-81a7be3fa22c983209cc0ffb3537b92b0370f83c.tar.bz2 |
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.
Diffstat (limited to 'Python/codecs.c')
-rw-r--r-- | Python/codecs.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Python/codecs.c b/Python/codecs.c index 6691985..32cc110 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) |