summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2019-11-05 00:22:12 (GMT)
committerGitHub <noreply@github.com>2019-11-05 00:22:12 (GMT)
commit17269090940aa20f6079a6b9f27ae319f8cdae14 (patch)
treef2c785c3fb8efb972639df7179b6d5b3b315e888 /Python/errors.c
parentbe434dc0380d9f5c7c800de9943cc46d55fd9491 (diff)
downloadcpython-17269090940aa20f6079a6b9f27ae319f8cdae14.zip
cpython-17269090940aa20f6079a6b9f27ae319f8cdae14.tar.gz
cpython-17269090940aa20f6079a6b9f27ae319f8cdae14.tar.bz2
bpo-38644: Pass tstate to _Py_CheckFunctionResult() (GH-17050)
* Add tstate parameter to _Py_CheckFunctionResult() * Add _PyErr_FormatFromCauseTstate() * Replace PyErr_XXX(...) with _PyErr_XXX(state, ...)
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/Python/errors.c b/Python/errors.c
index b935341..9658afe 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -521,6 +521,21 @@ _PyErr_FormatVFromCause(PyThreadState *tstate, PyObject *exception,
}
PyObject *
+_PyErr_FormatFromCauseTstate(PyThreadState *tstate, PyObject *exception,
+ const char *format, ...)
+{
+ va_list vargs;
+#ifdef HAVE_STDARG_PROTOTYPES
+ va_start(vargs, format);
+#else
+ va_start(vargs);
+#endif
+ _PyErr_FormatVFromCause(tstate, exception, format, vargs);
+ va_end(vargs);
+ return NULL;
+}
+
+PyObject *
_PyErr_FormatFromCause(PyObject *exception, const char *format, ...)
{
PyThreadState *tstate = _PyThreadState_GET();