From 838f26402de82640698c38ea9d2be65c6cf780d6 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 13 Jun 2019 22:41:23 +0200 Subject: bpo-36710: Pass explicitly tstate in sysmodule.c (GH-14060) * Replace global var Py_VerboseFlag with interp->config.verbose. * Add _PyErr_NoMemory(tstate) function. * Add tstate parameter to _PyEval_SetCoroutineOriginTrackingDepth() and move the function to the internal API. * Replace _PySys_InitMain(runtime, interp) with _PySys_InitMain(runtime, tstate). --- Python/errors.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Python/errors.c') diff --git a/Python/errors.c b/Python/errors.c index 8a94afdd8c..b3b9ac94cd 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -547,9 +547,8 @@ PyErr_BadArgument(void) } PyObject * -PyErr_NoMemory(void) +_PyErr_NoMemory(PyThreadState *tstate) { - PyThreadState *tstate = _PyThreadState_GET(); if (Py_TYPE(PyExc_MemoryError) == NULL) { /* PyErr_NoMemory() has been called before PyExc_MemoryError has been initialized by _PyExc_Init() */ @@ -560,6 +559,13 @@ PyErr_NoMemory(void) return NULL; } +PyObject * +PyErr_NoMemory(void) +{ + PyThreadState *tstate = _PyThreadState_GET(); + return _PyErr_NoMemory(tstate); +} + PyObject * PyErr_SetFromErrnoWithFilenameObject(PyObject *exc, PyObject *filenameObject) { -- cgit v1.2.1