From 105e7ba3e1520e8b6733c354ce802f7ae88788f1 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 2 Mar 2017 14:40:39 +0100 Subject: [PATCH] ensure octal format is fed an integer MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- deltatar/tarfile.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 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]) -- 1.7.1