[Bf-blender-cvs] [f326b6a18ea] master: Cleanup: avoid addition with large strings in Python
Campbell Barton
noreply at git.blender.org
Tue Jun 9 05:42:57 CEST 2020
Commit: f326b6a18eaba86c39d63a8b1c62a3e6ef0712cd
Author: Campbell Barton
Date: Tue Jun 9 13:40:51 2020 +1000
Branches: master
https://developer.blender.org/rBf326b6a18eaba86c39d63a8b1c62a3e6ef0712cd
Cleanup: avoid addition with large strings in Python
This is known to be inefficient, use a second write call instead.
===================================================================
M intern/cycles/blender/addon/osl.py
===================================================================
diff --git a/intern/cycles/blender/addon/osl.py b/intern/cycles/blender/addon/osl.py
index 90d349abb2e..4c6e7952491 100644
--- a/intern/cycles/blender/addon/osl.py
+++ b/intern/cycles/blender/addon/osl.py
@@ -84,7 +84,8 @@ def update_script_node(node, report):
if script.is_in_memory or script.is_dirty or script.is_modified or not os.path.exists(osl_path):
# write text datablock contents to temporary file
osl_file = tempfile.NamedTemporaryFile(mode='w', suffix=".osl", delete=False)
- osl_file.write(script.as_string() + "\n")
+ osl_file.write(script.as_string())
+ osl_file.write("\n")
osl_file.close()
ok, oso_path = osl_compile(osl_file.name, report)
More information about the Bf-blender-cvs
mailing list