Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-06-09 06:40:51 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-06-09 06:40:51 +0300
commitf326b6a18eaba86c39d63a8b1c62a3e6ef0712cd (patch)
tree3daf5998f3ecf1cd000456b56ac87ce66609a690 /intern/cycles/blender/addon
parent9f7d84b656fbb56966620ecc249ce5bc7089a1d1 (diff)
Cleanup: avoid addition with large strings in Python
This is known to be inefficient, use a second write call instead.
Diffstat (limited to 'intern/cycles/blender/addon')
-rw-r--r--intern/cycles/blender/addon/osl.py3
1 files changed, 2 insertions, 1 deletions
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)