summaryrefslogtreecommitdiff
path: root/numpy/core/numeric.py
diff options
context:
space:
mode:
authorBharat123rox <bharatraghunthan9767@gmail.com>2019-05-07 23:45:16 +0530
committerBharat123rox <bharatraghunthan9767@gmail.com>2019-05-07 23:45:16 +0530
commit38025696d7f268b47d81e215bcf33c50ca1c98c1 (patch)
tree667fbfc1d3e2fb68ce657ec8fc101921f6b9784d /numpy/core/numeric.py
parentdfc0e00eeeb9d3659aa8c06c5d6ea54c5d20742d (diff)
downloadnumpy-38025696d7f268b47d81e215bcf33c50ca1c98c1.tar.gz
Use with statement to open/close files to fix LGTM alerts
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r--numpy/core/numeric.py3
1 files changed, 2 insertions, 1 deletions
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)