#include <pytypes.h>
Public Member Functions | |
void | clear () |
void | discard_as_unraisable (object err_context) |
void | discard_as_unraisable (const char *err_context) |
error_already_set () | |
bool | matches (handle exc) const |
void | restore () |
const object & | trace () const |
const object & | type () const |
const object & | value () const |
const char * | what () const noexcept override |
Static Private Member Functions | |
static void | m_fetched_error_deleter (detail::error_fetch_and_normalize *raw_ptr) |
Private Attributes | |
std::shared_ptr< detail::error_fetch_and_normalize > | m_fetched_error |
Fetch and hold an error which was already set in Python. An instance of this is typically thrown to propagate python-side errors back through C++ which can either be caught manually or else falls back to the function dispatcher (which then raises the captured error back to python).
|
inline |
|
inline |
If it is impossible to raise the currently-held error, such as in a destructor, we can write it out using Python's unraisable hook (sys.unraisablehook
). The error context should be some object whose repr()
helps identify the location of the error. Python already knows the type and value of the error, so there is no need to repeat that.
|
inline |
An alternate version of discard_as_unraisable()
, where a string provides information on the location of the error. For example, __func__
could be helpful. WARNING: The GIL must be held when this member function is called!
|
inlinestaticprivate |
WARNING: This custom deleter needs to acquire the Python GIL. This can lead to crashes (undefined behavior) if the Python interpreter is finalizing.
Definition at line 2629 of file pybind11.h.
|
inline |
|
inline |
Restores the currently-held Python error (which will clear the Python error indicator first if already set). NOTE: This member function will always restore the normalized exception, which may or may not be the original Python exception. WARNING: The GIL must be held when this member function is called!
|
inlineoverridenoexcept |
The what() result is built lazily on demand. WARNING: This member function needs to acquire the Python GIL. This can lead to crashes (undefined behavior) if the Python interpreter is finalizing.
Definition at line 2635 of file pybind11.h.
|
private |