From 08b8a6d6b483ecf2c5b0b0dcc3c6d706d441936b Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 29 Apr 2024 17:54:30 +0200 Subject: Use ‘with’ syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gen/prop/age | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gen/prop/age b/gen/prop/age index 5733344..7105ae1 100755 --- a/gen/prop/age +++ b/gen/prop/age @@ -71,7 +71,6 @@ uprop_get_age(rune ch) def main() -> None: cwd_init() - sys.stdout = open('lib/unicode/prop/uprop_get_age.c', 'w') xs = parse('data/DerivedAge') blksize = -1 @@ -92,7 +91,9 @@ def main() -> None: blksize = bs Cs = [tuple(x) for x in chunks(xs, blksize)] - genfile(Cs, blksize) + with open('lib/unicode/prop/uprop_get_age.c', 'w') as f: + sys.stdout = f + genfile(Cs, blksize) if __name__ == '__main__': main() -- cgit v1.2.3