Blender V4.3
bpy_interface_atexit.cc File Reference
#include <Python.h>
#include "BLI_utildefines.h"
#include "bpy.hh"
#include "bpy_capi_utils.hh"
#include "WM_api.hh"

Go to the source code of this file.

Functions

static PyObject * bpy_atexit (PyObject *, PyObject *, PyObject *)
 
static void atexit_func_call (const char *func_name, PyObject *atexit_func_arg)
 
void BPY_atexit_register ()
 
void BPY_atexit_unregister ()
 

Variables

static PyMethodDef meth_bpy_atexit = {"bpy_atexit", (PyCFunction)bpy_atexit, METH_NOARGS, nullptr}
 
static PyObject * func_bpy_atregister = nullptr
 

Detailed Description

This file inserts an exit callback into Python's 'atexit' module. Without this sys.exit() can crash because blender is not properly closing resources.

Definition in file bpy_interface_atexit.cc.

Function Documentation

◆ atexit_func_call()

static void atexit_func_call ( const char * func_name,
PyObject * atexit_func_arg )
static

Definition at line 61 of file bpy_interface_atexit.cc.

References ret.

Referenced by BPY_atexit_register(), and BPY_atexit_unregister().

◆ bpy_atexit()

static PyObject * bpy_atexit ( PyObject * ,
PyObject * ,
PyObject *  )
static

Definition at line 22 of file bpy_interface_atexit.cc.

References BPY_context_get(), and WM_exit_ex().

◆ BPY_atexit_register()

void BPY_atexit_register ( )

Definition at line 88 of file bpy_interface_atexit.cc.

References atexit_func_call(), BLI_assert, func_bpy_atregister, and meth_bpy_atexit.

Referenced by BPY_python_start().

◆ BPY_atexit_unregister()

void BPY_atexit_unregister ( )

Definition at line 97 of file bpy_interface_atexit.cc.

References atexit_func_call(), BLI_assert, and func_bpy_atregister.

Referenced by BPY_python_end().

Variable Documentation

◆ func_bpy_atregister

PyObject* func_bpy_atregister = nullptr
static

Definition at line 59 of file bpy_interface_atexit.cc.

Referenced by BPY_atexit_register(), and BPY_atexit_unregister().

◆ meth_bpy_atexit

PyMethodDef meth_bpy_atexit = {"bpy_atexit", (PyCFunction)bpy_atexit, METH_NOARGS, nullptr}
static

Definition at line 53 of file bpy_interface_atexit.cc.

Referenced by BPY_atexit_register().