STINNER Victor <victor.stin...@haypocalc.com> added the comment:

Some comments about 2011-12-08-tarfile-lzma.diff:

> elif self.buf.startswith(b"\x5d\x00\x00\x80") or self.buf.startswith(b"...

Micro-optimization: you can use self.buf.startswith((b"\x5d\x00\x00\x80", 
b"\xfd7zXZ")) here.

> raise ValueError("mode must be 'r' or 'w'.")

Error messages usually don't end with a dot (or am I wrong?).

It would be better to use a skip instead of just return here:

def test_no_name_argument(self):
  if self.mode.endswith("bz2") or self.mode.endswith("xz"):
    # BZ2File and LZMAFile have no name attribute.
    return

In _Stream.__init__, for zlib:

> self.exception = zlib.error

Could you add a test for this change?

----------
nosy: +haypo

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5689>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to