diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/_warnings.c | 8 | ||||
-rw-r--r-- | Python/bltinmodule.c | 15 | ||||
-rw-r--r-- | Python/ceval.c | 11 |
3 files changed, 19 insertions, 15 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c index dd2b072d41..b8585d2047 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -1,4 +1,5 @@ #include "Python.h" +#include "pycore_pyerrors.h" #include "pycore_pystate.h" #include "frameobject.h" #include "clinic/_warnings.c.h" @@ -27,10 +28,11 @@ static struct PyModuleDef warningsmodule; static WarningsState * _Warnings_GetState() { - PyThreadState *tstate = PyThreadState_GET(); + PyThreadState *tstate = _PyThreadState_GET(); if (tstate == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "_Warnings_GetState: could not identify current interpreter"); + _PyErr_SetString(tstate, PyExc_RuntimeError, + "_Warnings_GetState: could not identify " + "current interpreter"); return NULL; } return &tstate->interp->warnings; diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index d79e254cc6..4470310a84 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -4,6 +4,7 @@ #include <ctype.h> #include "ast.h" #undef Yield /* undefine macro conflicting with <winbase.h> */ +#include "pycore_pyerrors.h" #include "pycore_pystate.h" #include "pycore_tupleobject.h" @@ -1254,23 +1255,23 @@ map_next(mapobject *lz) { PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; PyObject **stack; - Py_ssize_t niters, nargs, i; PyObject *result = NULL; + PyThreadState *tstate = _PyThreadState_GET(); - niters = PyTuple_GET_SIZE(lz->iters); + const Py_ssize_t niters = PyTuple_GET_SIZE(lz->iters); if (niters <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) { stack = small_stack; } else { stack = PyMem_Malloc(niters * sizeof(stack[0])); if (stack == NULL) { - PyErr_NoMemory(); + _PyErr_NoMemory(tstate); return NULL; } } - nargs = 0; - for (i=0; i < niters; i++) { + Py_ssize_t nargs = 0; + for (Py_ssize_t i=0; i < niters; i++) { PyObject *it = PyTuple_GET_ITEM(lz->iters, i); PyObject *val = Py_TYPE(it)->tp_iternext(it); if (val == NULL) { @@ -1280,10 +1281,10 @@ map_next(mapobject *lz) nargs++; } - result = _PyObject_FastCall(lz->func, stack, nargs); + result = _PyObject_VectorcallTstate(tstate, lz->func, stack, nargs, NULL); exit: - for (i=0; i < nargs; i++) { + for (Py_ssize_t i=0; i < nargs; i++) { Py_DECREF(stack[i]); } if (stack != small_stack) { diff --git a/Python/ceval.c b/Python/ceval.c index 046cd69151..11d25a53d5 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -10,6 +10,7 @@ #define PY_LOCAL_AGGRESSIVE #include "Python.h" +#include "pycore_call.h" #include "pycore_ceval.h" #include "pycore_code.h" #include "pycore_object.h" @@ -4306,7 +4307,6 @@ fail: /* Jump here from prelude on failure */ current Python frame (f), the associated C stack is still in use, so recursion_depth must be boosted for the duration. */ - assert(tstate != NULL); if (Py_REFCNT(f) > 1) { Py_DECREF(f); _PyObject_GC_TRACK(f); @@ -5024,10 +5024,11 @@ do_call_core(PyThreadState *tstate, PyObject *func, PyObject *callargs, PyObject return NULL; } - C_TRACE(result, _PyObject_FastCallDict(func, - &_PyTuple_ITEMS(callargs)[1], - nargs - 1, - kwdict)); + C_TRACE(result, _PyObject_FastCallDictTstate( + tstate, func, + &_PyTuple_ITEMS(callargs)[1], + nargs - 1, + kwdict)); Py_DECREF(func); return result; } |