22.02.2019 14:26, Andrey Shinkevich wrote: > The data type for bytes in Python3 differs from the one in Python2. > Those cases should be managed separately. > > v1: > In the first version, the TypeError in Python3 was handled as the > exception. > Discussed in the e-mail thread with the Message ID: > <1550519997-253534-1-git-send-email-andrey.shinkev...@virtuozzo.com> > > Signed-off-by: Andrey Shinkevich <andrey.shinkev...@virtuozzo.com> > Reported-by: Kevin Wolf <kw...@redhat.com> > --- > tests/qemu-iotests/242 | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/tests/qemu-iotests/242 b/tests/qemu-iotests/242 > index 16c65ed..446fbf8 100755 > --- a/tests/qemu-iotests/242 > +++ b/tests/qemu-iotests/242 > @@ -20,6 +20,7 @@ > > import iotests > import json > +import sys > from iotests import qemu_img_create, qemu_io, qemu_img_pipe, \ > file_path, img_info_log, log, filter_qemu_io > > @@ -65,9 +66,12 @@ def toggle_flag(offset): > with open(disk, "r+b") as f: > f.seek(offset, 0) > c = f.read(1) > - toggled = chr(ord(c) ^ bitmap_flag_unknown) > + toggled = ord(c) ^ bitmap_flag_unknown > f.seek(-1, 1) > - f.write(toggled) > + if sys.version_info.major >= 3: > + f.write(bytes([toggled])) > + else: > + f.write(chr(toggled)) > > > qemu_img_create('-f', iotests.imgfmt, disk, '1M') >
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> -- Best regards, Vladimir