summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-06-13 20:41:23 (GMT)
committerGitHub <noreply@github.com>2019-06-13 20:41:23 (GMT)
commit838f26402de82640698c38ea9d2be65c6cf780d6 (patch)
treeb5dfe2fa1c398c93291833fbd7beea911613a4b1 /Python/errors.c
parent3498c642f4e83f3d8e2214654c0fa8e0d51cebe5 (diff)
downloadcpython-838f26402de82640698c38ea9d2be65c6cf780d6.zip
cpython-838f26402de82640698c38ea9d2be65c6cf780d6.tar.gz
cpython-838f26402de82640698c38ea9d2be65c6cf780d6.tar.bz2
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).
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 8a94afd..b3b9ac9 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() */
@@ -561,6 +560,13 @@ PyErr_NoMemory(void)
}
PyObject *
+PyErr_NoMemory(void)
+{
+ PyThreadState *tstate = _PyThreadState_GET();
+ return _PyErr_NoMemory(tstate);
+}
+
+PyObject *
PyErr_SetFromErrnoWithFilenameObject(PyObject *exc, PyObject *filenameObject)
{
return PyErr_SetFromErrnoWithFilenameObjects(exc, filenameObject, NULL);