summaryrefslogtreecommitdiff
path: root/platform/SCsub
diff options
context:
space:
mode:
authorViktor Ferenczi <viktor@ferenczi.eu>2018-03-10 18:37:33 +0100
committerViktor Ferenczi <viktor@ferenczi.eu>2018-03-11 14:55:50 +0100
commit272ecddb2859e3c184886bc2d142e2e329b8ae83 (patch)
tree8f76dbf6737196fbb66a1b379e1f18437f609173 /platform/SCsub
parenteceba5aa6a36521c878cf976845123e820d27161 (diff)
Properly closing all files in Python code
Diffstat (limited to 'platform/SCsub')
-rw-r--r--platform/SCsub9
1 files changed, 4 insertions, 5 deletions
diff --git a/platform/SCsub b/platform/SCsub
index e624f8e90f..2019a30be7 100644
--- a/platform/SCsub
+++ b/platform/SCsub
@@ -18,11 +18,10 @@ for platform in env.platform_apis:
reg_apis_inc += '\n'
reg_apis += '}\n\n'
unreg_apis += '}\n'
-f = open_utf8('register_platform_apis.gen.cpp', 'w')
-f.write(reg_apis_inc)
-f.write(reg_apis)
-f.write(unreg_apis)
-f.close()
+with open_utf8('register_platform_apis.gen.cpp', 'w') as f:
+ f.write(reg_apis_inc)
+ f.write(reg_apis)
+ f.write(unreg_apis)
platform_sources.append('register_platform_apis.gen.cpp')
lib = env.add_library('platform', platform_sources)