From e5662aedef12b8d49c5c6c52d0e3fb47e66dbe0a Mon Sep 17 00:00:00 2001 From: Nicholas Bastin Date: Wed, 24 Mar 2004 22:22:12 +0000 Subject: Changed random calls to PyThreadState_Get() to use the macro --- Modules/threadmodule.c | 2 +- Python/ceval.c | 10 +++++----- Python/codecs.c | 10 +++++----- Python/errors.c | 2 +- Python/import.c | 4 ++-- Python/pystate.c | 2 +- Python/pythonrun.c | 6 +++--- Python/sysmodule.c | 16 ++++++++-------- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c index 24a32ae..b6b32f7 100644 --- a/Modules/threadmodule.c +++ b/Modules/threadmodule.c @@ -233,7 +233,7 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs) boot = PyMem_NEW(struct bootstate, 1); if (boot == NULL) return PyErr_NoMemory(); - boot->interp = PyThreadState_Get()->interp; + boot->interp = PyThreadState_GET()->interp; boot->func = func; boot->args = args; boot->keyw = keyw; diff --git a/Python/ceval.c b/Python/ceval.c index e136cb0..0595dbe 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2843,7 +2843,7 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb) { if (type == NULL) { /* Reraise */ - PyThreadState *tstate = PyThreadState_Get(); + PyThreadState *tstate = PyThreadState_GET(); type = tstate->exc_type == NULL ? Py_None : tstate->exc_type; value = tstate->exc_value; tb = tstate->exc_traceback; @@ -3221,7 +3221,7 @@ maybe_call_line_trace(Py_tracefunc func, PyObject *obj, void PyEval_SetProfile(Py_tracefunc func, PyObject *arg) { - PyThreadState *tstate = PyThreadState_Get(); + PyThreadState *tstate = PyThreadState_GET(); PyObject *temp = tstate->c_profileobj; Py_XINCREF(arg); tstate->c_profilefunc = NULL; @@ -3236,7 +3236,7 @@ PyEval_SetProfile(Py_tracefunc func, PyObject *arg) void PyEval_SetTrace(Py_tracefunc func, PyObject *arg) { - PyThreadState *tstate = PyThreadState_Get(); + PyThreadState *tstate = PyThreadState_GET(); PyObject *temp = tstate->c_traceobj; Py_XINCREF(arg); tstate->c_tracefunc = NULL; @@ -3254,7 +3254,7 @@ PyEval_GetBuiltins(void) { PyFrameObject *current_frame = PyEval_GetFrame(); if (current_frame == NULL) - return PyThreadState_Get()->interp->builtins; + return PyThreadState_GET()->interp->builtins; else return current_frame->f_builtins; } @@ -3282,7 +3282,7 @@ PyEval_GetGlobals(void) PyFrameObject * PyEval_GetFrame(void) { - PyThreadState *tstate = PyThreadState_Get(); + PyThreadState *tstate = PyThreadState_GET(); return _PyThreadState_GetFrame(tstate); } diff --git a/Python/codecs.c b/Python/codecs.c index a208898..7b31003 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -28,7 +28,7 @@ static int _PyCodecRegistry_Init(void); /* Forward */ int PyCodec_Register(PyObject *search_function) { - PyInterpreterState *interp = PyThreadState_Get()->interp; + PyInterpreterState *interp = PyThreadState_GET()->interp; if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) goto onError; if (search_function == NULL) { @@ -103,7 +103,7 @@ PyObject *_PyCodec_Lookup(const char *encoding) goto onError; } - interp = PyThreadState_Get()->interp; + interp = PyThreadState_GET()->interp; if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) goto onError; @@ -395,7 +395,7 @@ PyObject *PyCodec_Decode(PyObject *object, Return 0 on success, -1 on error */ int PyCodec_RegisterError(const char *name, PyObject *error) { - PyInterpreterState *interp = PyThreadState_Get()->interp; + PyInterpreterState *interp = PyThreadState_GET()->interp; if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) return -1; if (!PyCallable_Check(error)) { @@ -413,7 +413,7 @@ PyObject *PyCodec_LookupError(const char *name) { PyObject *handler = NULL; - PyInterpreterState *interp = PyThreadState_Get()->interp; + PyInterpreterState *interp = PyThreadState_GET()->interp; if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) return NULL; @@ -802,7 +802,7 @@ static int _PyCodecRegistry_Init(void) #endif }; - PyInterpreterState *interp = PyThreadState_Get()->interp; + PyInterpreterState *interp = PyThreadState_GET()->interp; PyObject *mod; int i; diff --git a/Python/errors.c b/Python/errors.c index 6416ff3..1da4cc3 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -205,7 +205,7 @@ finally: void PyErr_Fetch(PyObject **p_type, PyObject **p_value, PyObject **p_traceback) { - PyThreadState *tstate = PyThreadState_Get(); + PyThreadState *tstate = PyThreadState_GET(); *p_type = tstate->curexc_type; *p_value = tstate->curexc_value; diff --git a/Python/import.c b/Python/import.c index 5b9f162..5479677 100644 --- a/Python/import.c +++ b/Python/import.c @@ -321,7 +321,7 @@ imp_release_lock(PyObject *self, PyObject *noargs) PyObject * PyImport_GetModuleDict(void) { - PyInterpreterState *interp = PyThreadState_Get()->interp; + PyInterpreterState *interp = PyThreadState_GET()->interp; if (interp->modules == NULL) Py_FatalError("PyImport_GetModuleDict: no module dictionary!"); return interp->modules; @@ -353,7 +353,7 @@ PyImport_Cleanup(void) int pos, ndone; char *name; PyObject *key, *value, *dict; - PyInterpreterState *interp = PyThreadState_Get()->interp; + PyInterpreterState *interp = PyThreadState_GET()->interp; PyObject *modules = interp->modules; if (modules == NULL) diff --git a/Python/pystate.c b/Python/pystate.c index 5793612..b0eb4c4 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -313,7 +313,7 @@ PyThreadState_GetDict(void) int PyThreadState_SetAsyncExc(long id, PyObject *exc) { - PyThreadState *tstate = PyThreadState_Get(); + PyThreadState *tstate = PyThreadState_GET(); PyInterpreterState *interp = tstate->interp; PyThreadState *p; int count = 0; diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 614e65d..113ff2d 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -316,7 +316,7 @@ Py_Finalize(void) initialized = 0; /* Get current thread state and interpreter pointer */ - tstate = PyThreadState_Get(); + tstate = PyThreadState_GET(); interp = tstate->interp; /* Disable signal handling */ @@ -529,7 +529,7 @@ Py_EndInterpreter(PyThreadState *tstate) { PyInterpreterState *interp = tstate->interp; - if (tstate != PyThreadState_Get()) + if (tstate != PyThreadState_GET()) Py_FatalError("Py_EndInterpreter: thread is not current"); if (tstate->frame != NULL) Py_FatalError("Py_EndInterpreter: thread still has a frame"); @@ -1461,7 +1461,7 @@ err_input(perrdetail *err) msg = "too many levels of indentation"; break; case E_DECODE: { /* XXX */ - PyThreadState* tstate = PyThreadState_Get(); + PyThreadState* tstate = PyThreadState_GET(); PyObject* value = tstate->curexc_value; if (value != NULL) { u = PyObject_Repr(value); diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 4e7035a..09e411e 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -48,7 +48,7 @@ extern const char *PyWin_DLLVersionString; PyObject * PySys_GetObject(char *name) { - PyThreadState *tstate = PyThreadState_Get(); + PyThreadState *tstate = PyThreadState_GET(); PyObject *sd = tstate->interp->sysdict; if (sd == NULL) return NULL; @@ -70,7 +70,7 @@ PySys_GetFile(char *name, FILE *def) int PySys_SetObject(char *name, PyObject *v) { - PyThreadState *tstate = PyThreadState_Get(); + PyThreadState *tstate = PyThreadState_GET(); PyObject *sd = tstate->interp->sysdict; if (v == NULL) { if (PyDict_GetItemString(sd, name) == NULL) @@ -86,7 +86,7 @@ static PyObject * sys_displayhook(PyObject *self, PyObject *o) { PyObject *outf; - PyInterpreterState *interp = PyThreadState_Get()->interp; + PyInterpreterState *interp = PyThreadState_GET()->interp; PyObject *modules = interp->modules; PyObject *builtins = PyDict_GetItemString(modules, "__builtin__"); @@ -149,7 +149,7 @@ static PyObject * sys_exc_info(PyObject *self, PyObject *noargs) { PyThreadState *tstate; - tstate = PyThreadState_Get(); + tstate = PyThreadState_GET(); return Py_BuildValue( "(OOO)", tstate->exc_type != NULL ? tstate->exc_type : Py_None, @@ -168,7 +168,7 @@ clause in the current stack frame or in an older stack frame." static PyObject * sys_exc_clear(PyObject *self, PyObject *noargs) { - PyThreadState *tstate = PyThreadState_Get(); + PyThreadState *tstate = PyThreadState_GET(); PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; @@ -514,7 +514,7 @@ static PyObject * sys_setdlopenflags(PyObject *self, PyObject *args) { int new_val; - PyThreadState *tstate = PyThreadState_Get(); + PyThreadState *tstate = PyThreadState_GET(); if (!PyArg_ParseTuple(args, "i:setdlopenflags", &new_val)) return NULL; if (!tstate) @@ -537,7 +537,7 @@ sys.setdlopenflags(dl.RTLD_NOW|dl.RTLD_GLOBAL)" static PyObject * sys_getdlopenflags(PyObject *self, PyObject *args) { - PyThreadState *tstate = PyThreadState_Get(); + PyThreadState *tstate = PyThreadState_GET(); if (!tstate) return NULL; return PyInt_FromLong(tstate->interp->dlopenflags); @@ -615,7 +615,7 @@ purposes only." static PyObject * sys_getframe(PyObject *self, PyObject *args) { - PyFrameObject *f = PyThreadState_Get()->frame; + PyFrameObject *f = PyThreadState_GET()->frame; int depth = -1; if (!PyArg_ParseTuple(args, "|i:_getframe", &depth)) -- cgit v0.12