]> granicus.if.org Git - python/commitdiff
Changed random calls to PyThreadState_Get() to use the macro
authorNicholas Bastin <nick.bastin@gmail.com>
Wed, 24 Mar 2004 22:22:12 +0000 (22:22 +0000)
committerNicholas Bastin <nick.bastin@gmail.com>
Wed, 24 Mar 2004 22:22:12 +0000 (22:22 +0000)
Modules/threadmodule.c
Python/ceval.c
Python/codecs.c
Python/errors.c
Python/import.c
Python/pystate.c
Python/pythonrun.c
Python/sysmodule.c

index 24a32ae3252772840cb30a9d9beb7ec02e88f1d7..b6b32f7c8550c80d0c1012f4ba84f58df0f189b7 100644 (file)
@@ -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;
index e136cb0a059f18eb2014161946f49e01fb1e6998..0595dbeb063148564cdbae305d91cf82771bcade 100644 (file)
@@ -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);
 }
 
index a208898e8c07aaa9c78f0d4e0026fb7d185c6514..7b31003f333b64d7d1398f8b7d514662ea67ad15 100644 (file)
@@ -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;
 
index 6416ff3a5a17427a8c83f1c580a394b927a957af..1da4cc33fa750bb38b7f7698b34c6d97e492f43d 100644 (file)
@@ -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;
index 5b9f162387324d0efcce989f426703a9b74a2af5..5479677aa3dd14d9e3ae58aee30dbada5a943092 100644 (file)
@@ -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)
index 5793612b51a0596082cb702700e326bbe1da22f2..b0eb4c48a72bdb2d4b7b1314df6fc26c07fc3bca 100644 (file)
@@ -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;
index 614e65de12d91984d71d59d8fd29eec622303abd..113ff2d61a4545ff5a483dbb3232b33f9a5676c3 100644 (file)
@@ -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);
index 4e7035a9bbe31f7a4494178243c83c7b8f49d09a..09e411e288aa9ac7a36f665992d7411dea7c2ce3 100644 (file)
@@ -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))