From 6c9a85c3878b16e26bb492b0d3c0a5939b6be6f3 Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Fri, 15 May 2020 15:21:05 -0700 Subject: [PATCH] fix resourcewarning --- rednose/helpers/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rednose/helpers/__init__.py b/rednose/helpers/__init__.py index 0634321..1588a43 100644 --- a/rednose/helpers/__init__.py +++ b/rednose/helpers/__init__.py @@ -15,7 +15,9 @@ def write_code(folder, name, code, header): def load_code(folder, name): shared_fn = os.path.join(folder, f"lib{name}.so") header_fn = os.path.join(folder, f"{name}.h") - header = open(header_fn).read() + + with open(header_fn) as f: + header = f.read() ffi = FFI() ffi.cdef(header)