2 * SPDX-License-Identifier: MIT
4 * Copyright (c) 2019 EfficiOS Inc. and Linux Foundation
5 * Copyright (c) 2019 Philippe Proulx <pproulx@efficios.com>
6 * Copyright (c) 2019 Simon Marchi <simon.marchi@efficios.com>
9 #ifndef BABELTRACE_PY_COMMON_INTERNAL_H
10 #define BABELTRACE_PY_COMMON_INTERNAL_H
16 #include "common/macros.h"
19 * Formats the Python traceback `py_exc_tb` using traceback.format_tb, from the
20 * Python standard library, and return it as a Gstring.
22 GString
*bt_py_common_format_tb(PyObject
*py_exc_tb
, int log_level
);
25 * Formats the Python exception described by `py_exc_type`, `py_exc_value`
26 * and `py_exc_tb` and returns the formatted string, or `NULL` on error. The
27 * returned string does NOT end with a newline.
29 * If `chain` is true, include all exceptions in the causality chain
30 * (see parameter `chain` of Python's traceback.format_exception).
32 GString
*bt_py_common_format_exception(PyObject
*py_exc_type
,
33 PyObject
*py_exc_value
, PyObject
*py_exc_tb
,
34 int log_level
, bool chain
);
37 * Wrapper for `bt_py_common_format_exception` that passes the Python error
38 * indicator (the exception currently being raised). Always include the
39 * full exception chain.
41 * You must ensure that the error indicator is set with PyErr_Occurred()
42 * before you call this function.
44 * This function does not modify the error indicator, that is, anything
45 * that is fetched is always restored.
47 GString
*bt_py_common_format_current_exception(int log_level
);
49 #endif /* BABELTRACE_PY_COMMON_INTERNAL_H */
This page took 0.035732 seconds and 4 git commands to generate.