Wolfgang Maier added the comment: something like:
def write(self,data): self._check_closed() if self.mode != WRITE: import errno raise OSError(errno.EBADF, "write() on read-only GzipFile object") if self.fileobj is None: raise ValueError("write() on closed GzipFile object") if isinstance(data, bytes): length = len(data) elif isinstance(data, memoryview) and not data.c_contiguous: data = data.tobytes() length = len(data) else: # accept any data that supports the buffer protocol data = memoryview(data) length = data.nbytes if length > 0: self.fileobj.write(self.compress.compress(data)) self.size += length self.crc = zlib.crc32(data, self.crc) & 0xffffffff self.offset += length return length ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23688> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com