From 272ecddb2859e3c184886bc2d142e2e329b8ae83 Mon Sep 17 00:00:00 2001 From: Viktor Ferenczi Date: Sat, 10 Mar 2018 18:37:33 +0100 Subject: Properly closing all files in Python code --- platform/SCsub | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'platform/SCsub') 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) -- cgit v1.2.3