32static PyObject *
bpy_atexit(PyObject * , PyObject * , PyObject * )
47 const bool do_python_exit =
false;
51 const bool do_user_exit_actions =
false;
53 WM_exit_ex(
C, do_python_exit, do_user_exit_actions);
55#if !defined(WITH_PYTHON_MODULE) && defined(_WIN32) && defined(_M_ARM64)
65 if (exit_code.has_value()) {
72 TerminateProcess(GetCurrentProcess(), exit_code.value_or(0));
74 std::_Exit(exit_code.value_or(0));
111 PyObject *atexit_mod = PyImport_ImportModuleLevel(
"atexit",
nullptr,
nullptr,
nullptr, 0);
112 PyObject *atexit_func = PyObject_GetAttrString(atexit_mod, func_name);
113 PyObject *args = PyTuple_New(1);
116 PyTuple_SET_ITEM(args, 0, atexit_func_arg);
117 Py_INCREF(atexit_func_arg);
119 ret = PyObject_CallObject(atexit_func, args);
121 Py_DECREF(atexit_mod);
122 Py_DECREF(atexit_func);