Cleanup: avoid addition with large strings in Python

This is known to be inefficient, use a second write call instead.
This commit is contained in:
Campbell Barton 2020-06-09 13:40:51 +10:00
parent 9f7d84b656
commit f326b6a18e
1 changed files with 2 additions and 1 deletions

View File

@ -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)