Skip to content

Commit 8cbed8c

Browse files
committed
ENH: Remove deprecation warning from GzipFile wrapper.
1 parent 277c740 commit 8cbed8c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

numpy/lib/npyio.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ def tell(self):
6161
if isinstance(f, str):
6262
f = GzipFile(f)
6363
elif isinstance(f, gzip.GzipFile):
64-
# cast if its a gzip.GzipFile
65-
mode = f.mode
66-
f = GzipFile(filename=f.filename, fileobj=f.fileobj)
67-
f.mode = mode
64+
# cast to our GzipFile if its already a gzip.GzipFile
65+
g = GzipFile(fileobj=f.fileobj)
66+
g.name = f.name
67+
g.mode = f.mode
68+
69+
f = g
6870

6971
return f
7072

0 commit comments

Comments
 (0)