[Bf-blender-cvs] [19afb0ea672] master: Cleanup: remove redundant static variable use

Campbell Barton noreply at git.blender.org
Thu Jul 23 06:05:12 CEST 2020


Commit: 19afb0ea672220cd373d44b71e7658cbdf976d70
Author: Campbell Barton
Date:   Thu Jul 23 13:52:52 2020 +1000
Branches: master
https://developer.blender.org/rB19afb0ea672220cd373d44b71e7658cbdf976d70

Cleanup: remove redundant static variable use

This hasn't been needed since Python 3.7x.

===================================================================

M	source/blender/python/generic/py_capi_utils.c
M	source/blender/python/intern/bpy_interface.c

===================================================================

diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 9c84a4bb824..1051780d821 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -841,7 +841,7 @@ void PyC_SetHomePath(const char *py_path_bundle)
 #  endif
 
   {
-    static wchar_t py_path_bundle_wchar[1024];
+    wchar_t py_path_bundle_wchar[1024];
 
     /* Can't use this, on linux gives bug: #23018,
      * TODO: try LANG="en_US.UTF-8" /usr/bin/blender, suggested 2008 */
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index a880d2cd285..c40b2ded8ff 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -258,11 +258,13 @@ void BPY_python_start(int argc, const char **argv)
   PyThreadState *py_tstate = NULL;
   const char *py_path_bundle = BKE_appdir_folder_id(BLENDER_SYSTEM_PYTHON, NULL);
 
-  /* not essential but nice to set our name */
-  static wchar_t program_path_wchar[FILE_MAX]; /* python holds a reference */
-  BLI_strncpy_wchar_from_utf8(
-      program_path_wchar, BKE_appdir_program_path(), ARRAY_SIZE(program_path_wchar));
-  Py_SetProgramName(program_path_wchar);
+  /* Not essential but nice to set our name. */
+  {
+    const char *program_path = BKE_appdir_program_path();
+    wchar_t program_path_wchar[FILE_MAX];
+    BLI_strncpy_wchar_from_utf8(program_path_wchar, program_path, ARRAY_SIZE(program_path_wchar));
+    Py_SetProgramName(program_path_wchar);
+  }
 
   /* must run before python initializes */
   PyImport_ExtendInittab(bpy_internal_modules);



More information about the Bf-blender-cvs mailing list