From d3a27e4c9339d787f2eb3e68fd3b12e303cb4a42 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 24 Jun 2022 11:59:32 +0200 Subject: gh-94196: Remove gzip.GzipFile.filename attribute (#94197) gzip: Remove the filename attribute of gzip.GzipFile, deprecated since Python 2.6, use the name attribute instead. In write mode, the filename attribute added '.gz' file extension if it was not present. --- Lib/gzip.py | 8 -------- 1 file changed, 8 deletions(-) (limited to 'Lib') diff --git a/Lib/gzip.py b/Lib/gzip.py index 5b20e5ba69..8edcda4493 100644 --- a/Lib/gzip.py +++ b/Lib/gzip.py @@ -212,14 +212,6 @@ class GzipFile(_compression.BaseStream): if self.mode == WRITE: self._write_gzip_header(compresslevel) - @property - def filename(self): - import warnings - warnings.warn("use the name attribute", DeprecationWarning, 2) - if self.mode == WRITE and self.name[-3:] != ".gz": - return self.name + ".gz" - return self.name - @property def mtime(self): """Last modification time read from stream, or None""" -- cgit v1.2.1