Cleanup: move Python's GIL ensure/release to the function start/end
Avoid errors accessing state without the GIL (#127767) by moving GIL ensure/release to the star/end of the function body.
This commit is contained in:
@@ -62,10 +62,11 @@ static int bpy_cli_command_exec(bContext *C,
|
||||
const int argc,
|
||||
const char **argv)
|
||||
{
|
||||
int exit_code = EXIT_FAILURE;
|
||||
PyGILState_STATE gilstate;
|
||||
bpy_context_set(C, &gilstate);
|
||||
|
||||
int exit_code = EXIT_FAILURE;
|
||||
|
||||
/* For the most part `sys.argv[-argc:]` is sufficient & less trouble than re-creating this
|
||||
* list. Don't do this because:
|
||||
* - Python scripts *could* have manipulated `sys.argv` (although it's bad practice).
|
||||
|
||||
Reference in New Issue
Block a user