From 38025696d7f268b47d81e215bcf33c50ca1c98c1 Mon Sep 17 00:00:00 2001 From: Bharat123rox Date: Tue, 7 May 2019 23:45:16 +0530 Subject: Use with statement to open/close files to fix LGTM alerts --- numpy/core/numeric.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'numpy/core/numeric.py') diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 34705efc7..c2fc8da16 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1984,7 +1984,8 @@ def load(file): "np.core.numeric.load is deprecated, use pickle.load instead", DeprecationWarning, stacklevel=2) if isinstance(file, type("")): - file = open(file, "rb") + with open(file, "rb") as file_pointer: + return pickle.load(file_pointer) return pickle.load(file) -- cgit v1.2.1