mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Zap ZAP.
This commit is contained in:
parent
48bbaf2375
commit
ab0e284a24
1 changed files with 18 additions and 25 deletions
|
@ -23,13 +23,6 @@ the expense of doing their own locking).
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define ZAP(x) { \
|
|
||||||
PyObject *tmp = (PyObject *)(x); \
|
|
||||||
(x) = NULL; \
|
|
||||||
Py_XDECREF(tmp); \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef WITH_THREAD
|
#ifdef WITH_THREAD
|
||||||
#include "pythread.h"
|
#include "pythread.h"
|
||||||
static PyThread_type_lock head_mutex = NULL; /* Protects interp->tstate_head */
|
static PyThread_type_lock head_mutex = NULL; /* Protects interp->tstate_head */
|
||||||
|
@ -106,12 +99,12 @@ PyInterpreterState_Clear(PyInterpreterState *interp)
|
||||||
for (p = interp->tstate_head; p != NULL; p = p->next)
|
for (p = interp->tstate_head; p != NULL; p = p->next)
|
||||||
PyThreadState_Clear(p);
|
PyThreadState_Clear(p);
|
||||||
HEAD_UNLOCK();
|
HEAD_UNLOCK();
|
||||||
ZAP(interp->codec_search_path);
|
Py_CLEAR(interp->codec_search_path);
|
||||||
ZAP(interp->codec_search_cache);
|
Py_CLEAR(interp->codec_search_cache);
|
||||||
ZAP(interp->codec_error_registry);
|
Py_CLEAR(interp->codec_error_registry);
|
||||||
ZAP(interp->modules);
|
Py_CLEAR(interp->modules);
|
||||||
ZAP(interp->sysdict);
|
Py_CLEAR(interp->sysdict);
|
||||||
ZAP(interp->builtins);
|
Py_CLEAR(interp->builtins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -215,23 +208,23 @@ PyThreadState_Clear(PyThreadState *tstate)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"PyThreadState_Clear: warning: thread still has a frame\n");
|
"PyThreadState_Clear: warning: thread still has a frame\n");
|
||||||
|
|
||||||
ZAP(tstate->frame);
|
Py_CLEAR(tstate->frame);
|
||||||
|
|
||||||
ZAP(tstate->dict);
|
Py_CLEAR(tstate->dict);
|
||||||
ZAP(tstate->async_exc);
|
Py_CLEAR(tstate->async_exc);
|
||||||
|
|
||||||
ZAP(tstate->curexc_type);
|
Py_CLEAR(tstate->curexc_type);
|
||||||
ZAP(tstate->curexc_value);
|
Py_CLEAR(tstate->curexc_value);
|
||||||
ZAP(tstate->curexc_traceback);
|
Py_CLEAR(tstate->curexc_traceback);
|
||||||
|
|
||||||
ZAP(tstate->exc_type);
|
Py_CLEAR(tstate->exc_type);
|
||||||
ZAP(tstate->exc_value);
|
Py_CLEAR(tstate->exc_value);
|
||||||
ZAP(tstate->exc_traceback);
|
Py_CLEAR(tstate->exc_traceback);
|
||||||
|
|
||||||
tstate->c_profilefunc = NULL;
|
tstate->c_profilefunc = NULL;
|
||||||
tstate->c_tracefunc = NULL;
|
tstate->c_tracefunc = NULL;
|
||||||
ZAP(tstate->c_profileobj);
|
Py_CLEAR(tstate->c_profileobj);
|
||||||
ZAP(tstate->c_traceobj);
|
Py_CLEAR(tstate->c_traceobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -360,7 +353,7 @@ PyThreadState_SetAsyncExc(long id, PyObject *exc) {
|
||||||
for (p = interp->tstate_head; p != NULL; p = p->next) {
|
for (p = interp->tstate_head; p != NULL; p = p->next) {
|
||||||
if (p->thread_id != id)
|
if (p->thread_id != id)
|
||||||
continue;
|
continue;
|
||||||
ZAP(p->async_exc);
|
Py_CLEAR(p->async_exc);
|
||||||
Py_XINCREF(exc);
|
Py_XINCREF(exc);
|
||||||
p->async_exc = exc;
|
p->async_exc = exc;
|
||||||
count += 1;
|
count += 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue