From patchwork Mon Jun 11 17:42:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 927807 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 414L3D4LhFz9ryk for ; Tue, 12 Jun 2018 03:43:36 +1000 (AEST) Received: from localhost ([::1]:50534 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSQqs-0001lt-7y for incoming@patchwork.ozlabs.org; Mon, 11 Jun 2018 13:43:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSQqE-0001k0-17 for qemu-devel@nongnu.org; Mon, 11 Jun 2018 13:42:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSQqD-0000EB-2o for qemu-devel@nongnu.org; Mon, 11 Jun 2018 13:42:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44170) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fSQqC-0000E4-Te for qemu-devel@nongnu.org; Mon, 11 Jun 2018 13:42:53 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 142665F7BF; Mon, 11 Jun 2018 17:42:52 +0000 (UTC) Received: from localhost (ovpn-116-19.gru2.redhat.com [10.97.116.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 96C8816C66; Mon, 11 Jun 2018 17:42:51 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Mon, 11 Jun 2018 14:42:33 -0300 Message-Id: <20180611174243.31070-4-ehabkost@redhat.com> In-Reply-To: <20180611174243.31070-1-ehabkost@redhat.com> References: <20180611174243.31070-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 11 Jun 2018 17:42:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 03/13] python: futurize -f libfuturize.fixes.fix_next_call X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Cleber Rosa Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Change obj.next() calls to next(obj). This is necessary for Python 3 compatibility. Done using: $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ sort -u | grep -v README.sh4) $ futurize -w -f libfuturize.fixes.fix_next_call $py Reviewed-by: Stefan Hajnoczi Signed-off-by: Eduardo Habkost Message-Id: <20180608122952.2009-4-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- scripts/ordereddict.py | 4 ++-- scripts/vmstate-static-checker.py | 4 ++-- tests/image-fuzzer/runner.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/ordereddict.py b/scripts/ordereddict.py index 2d1d81370b..68ed340b33 100644 --- a/scripts/ordereddict.py +++ b/scripts/ordereddict.py @@ -71,9 +71,9 @@ class OrderedDict(dict, DictMixin): if not self: raise KeyError('dictionary is empty') if last: - key = reversed(self).next() + key = next(reversed(self)) else: - key = iter(self).next() + key = next(iter(self)) value = self.pop(key) return key, value diff --git a/scripts/vmstate-static-checker.py b/scripts/vmstate-static-checker.py index 60d1bf4cda..d3467288dc 100755 --- a/scripts/vmstate-static-checker.py +++ b/scripts/vmstate-static-checker.py @@ -158,7 +158,7 @@ def check_fields(src_fields, dest_fields, desc, sec): while True: if advance_src: try: - s_item = s_iter.next() + s_item = next(s_iter) except StopIteration: if s_iter_list == []: break @@ -173,7 +173,7 @@ def check_fields(src_fields, dest_fields, desc, sec): if advance_dest: try: - d_item = d_iter.next() + d_item = next(d_iter) except StopIteration: if d_iter_list == []: # We were not in a substruct diff --git a/tests/image-fuzzer/runner.py b/tests/image-fuzzer/runner.py index 8de656933e..45e8fca63f 100755 --- a/tests/image-fuzzer/runner.py +++ b/tests/image-fuzzer/runner.py @@ -422,7 +422,7 @@ if __name__ == '__main__': test_id = count(1) while should_continue(duration, start_time): try: - run_test(str(test_id.next()), seed, work_dir, run_log, cleanup, + run_test(str(next(test_id)), seed, work_dir, run_log, cleanup, log_all, command, config) except (KeyboardInterrupt, SystemExit): sys.exit(1)