Changed random calls to PyThreadState_Get() to use the macro

This commit is contained in:
Nicholas Bastin 2004-03-24 22:22:12 +00:00
parent c69ebe8d50
commit e5662aedef
8 changed files with 26 additions and 26 deletions

View 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;

View 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);
}

View 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;

View file

@ -205,7 +205,7 @@ PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb)
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;

View 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)

View 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;

View 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);

View 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))