summaryrefslogtreecommitdiff
path: root/numpy/lib/npyio.py
diff options
context:
space:
mode:
authorStefan van der Walt <stefan@sun.ac.za>2010-11-18 10:17:36 +0200
committerStefan van der Walt <stefan@sun.ac.za>2010-11-18 10:17:36 +0200
commit8cbed8ce5253a0aa4341e6edbf8be123a06bb123 (patch)
tree7e35de17a70e9930ef1f2304e974937912e71ff9 /numpy/lib/npyio.py
parent277c740f798b93a4348054bcd9ee6f6e42f659e0 (diff)
downloadnumpy-8cbed8ce5253a0aa4341e6edbf8be123a06bb123.tar.gz
ENH: Remove deprecation warning from GzipFile wrapper.
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r--numpy/lib/npyio.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py
index c9c02518b..4a56a6ecc 100644
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -61,10 +61,12 @@ def seek_gzip_factory(f):
if isinstance(f, str):
f = GzipFile(f)
elif isinstance(f, gzip.GzipFile):
- # cast if its a gzip.GzipFile
- mode = f.mode
- f = GzipFile(filename=f.filename, fileobj=f.fileobj)
- f.mode = mode
+ # cast to our GzipFile if its already a gzip.GzipFile
+ g = GzipFile(fileobj=f.fileobj)
+ g.name = f.name
+ g.mode = f.mode
+
+ f = g
return f