Blender V4.3
bpy_capi_utils.hh File Reference
#include <Python.h>

Go to the source code of this file.

Functions

short BPy_reports_to_error (struct ReportList *reports, PyObject *exception, bool clear)
 
void BPy_reports_write_stdout (const struct ReportList *reports, const char *header)
 
bool BPy_errors_to_report_ex (struct ReportList *reports, const char *error_prefix, bool use_full, bool use_location)
 
bool BPy_errors_to_report (struct ReportList *reports)
 
struct bContextBPY_context_get (void)
 
void bpy_context_set (struct bContext *C, PyGILState_STATE *gilstate)
 
void bpy_context_clear (struct bContext *C, const PyGILState_STATE *gilstate)
 

Function Documentation

◆ bpy_context_clear()

◆ BPY_context_get()

◆ bpy_context_set()

◆ BPy_errors_to_report()

bool BPy_errors_to_report ( struct ReportList * reports)
Parameters
reportsAny errors will be added to the report list.
Note
The reports are never printed to the stdout/stderr, so you may wish to call either BKE_reports_print(reports) or PyErr_Print() afterwards. Typically PyErr_Print() is preferable as sys.excepthook is called.
The caller is responsible for clearing the error (see #PyErr_Clear).

Definition at line 137 of file bpy_capi_utils.cc.

References BPy_errors_to_report_ex().

Referenced by bpy_class_call(), bpy_run_string_impl(), and python_script_exec().

◆ BPy_errors_to_report_ex()

bool BPy_errors_to_report_ex ( struct ReportList * reports,
const char * error_prefix,
bool use_full,
bool use_location )

◆ BPy_reports_to_error()

short BPy_reports_to_error ( struct ReportList * reports,
PyObject * exception,
bool clear )

Error reporting: convert BKE_report (ReportList) reports into python errors.

Parameters
clearWhen true, BKE_reports_free is called on the given reports, which should then be considered as 'freed' data and not used anymore.

Definition at line 25 of file bpy_capi_utils.cc.

References BKE_reports_free(), BKE_reports_string(), clear(), MEM_freeN(), and RPT_ERROR.

Referenced by bpy_lib_enter(), bpy_lib_write(), pyop_call(), pyrna_func_call(), pyrna_py_to_prop(), pyrna_register_class(), pyrna_struct_driver_add(), pyrna_struct_driver_remove(), pyrna_struct_keyframe_delete(), and pyrna_struct_keyframe_insert().

◆ BPy_reports_write_stdout()

void BPy_reports_write_stdout ( const struct ReportList * reports,
const char * header )

A version of BKE_report_write_file_fp that uses Python's stdout.