diff options
author | Anthony Baxter <anthonybaxter@gmail.com> | 2006-04-11 12:01:56 (GMT) |
---|---|---|
committer | Anthony Baxter <anthonybaxter@gmail.com> | 2006-04-11 12:01:56 (GMT) |
commit | 7b782b61c597a989a21a22c15ee95decf997429f (patch) | |
tree | 8a34ffd3e534d54448916a1fea9bfec7297a6996 /Python/pystate.c | |
parent | 9176fc1466c8a896ab57b054bd426e63770e2cfa (diff) | |
download | cpython-7b782b61c597a989a21a22c15ee95decf997429f.zip cpython-7b782b61c597a989a21a22c15ee95decf997429f.tar.gz cpython-7b782b61c597a989a21a22c15ee95decf997429f.tar.bz2 |
more low-hanging fruit to make code compile under a C++ compiler. Not
entirely happy with the two new VISIT macros in compile.c, but I
couldn't see a better approach.
Diffstat (limited to 'Python/pystate.c')
-rw-r--r-- | Python/pystate.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Python/pystate.c b/Python/pystate.c index 867334e..ca19b76 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -297,23 +297,23 @@ PyThreadState_Get(void) PyThreadState * -PyThreadState_Swap(PyThreadState *new) +PyThreadState_Swap(PyThreadState *newts) { - PyThreadState *old = _PyThreadState_Current; + PyThreadState *oldts = _PyThreadState_Current; - _PyThreadState_Current = new; + _PyThreadState_Current = newts; /* It should not be possible for more than one thread state to be used for a thread. Check this the best we can in debug builds. */ #if defined(Py_DEBUG) && defined(WITH_THREAD) - if (new) { + if (newts) { PyThreadState *check = PyGILState_GetThisThreadState(); - if (check && check->interp == new->interp && check != new) + if (check && check->interp == newts->interp && check != newts) Py_FatalError("Invalid thread state for this thread"); } #endif - return old; + return oldts; } /* An extension mechanism to store arbitrary additional per-thread state. @@ -491,7 +491,7 @@ PyGILState_Ensure(void) called Py_Initialize() and usually PyEval_InitThreads(). */ assert(autoInterpreterState); /* Py_Initialize() hasn't been called! */ - tcur = PyThread_get_key_value(autoTLSkey); + tcur = (PyThreadState *)PyThread_get_key_value(autoTLSkey); if (tcur == NULL) { /* Create a new thread state for this thread */ tcur = PyThreadState_New(autoInterpreterState); @@ -518,7 +518,8 @@ PyGILState_Ensure(void) void PyGILState_Release(PyGILState_STATE oldstate) { - PyThreadState *tcur = PyThread_get_key_value(autoTLSkey); + PyThreadState *tcur = (PyThreadState *)PyThread_get_key_value( + autoTLSkey); if (tcur == NULL) Py_FatalError("auto-releasing thread-state, " "but no thread-state for this thread"); |