From: Philipp Gesang Date: Thu, 2 Mar 2017 13:40:39 +0000 (+0100) Subject: ensure octal format is fed an integer X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=105e7ba3e1520e8b6733c354ce802f7ae88788f1;p=python-delta-tar ensure octal format is fed an integer Fix a “type” error that seems to be enforced by Python 3: File "/src/python/python-delta-tar/deltatar/tarfile.py", line 220, in itn s = bytes("%0*o" % (digits - 1, n), "ascii") + NUL TypeError: %o format: an integer is required, not float --- diff --git a/deltatar/tarfile.py b/deltatar/tarfile.py index 9303a09..35c538d 100644 --- a/deltatar/tarfile.py +++ b/deltatar/tarfile.py @@ -217,7 +217,7 @@ def itn(n, digits=8, format=DEFAULT_FORMAT): # A 0o200 byte indicates a positive number, a 0o377 byte a negative # number. if 0 <= n < 8 ** (digits - 1): - s = bytes("%0*o" % (digits - 1, n), "ascii") + NUL + s = bytes("%0*o" % (digits - 1, int(n)), "ascii") + NUL elif format == GNU_FORMAT and -256 ** (digits - 1) <= n < 256 ** (digits - 1): if n >= 0: s = bytearray([0o200])