From c375b2f1c74efe3af95434adfcf4a965b16fee86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 18 Oct 2023 18:28:04 +0200 Subject: [PATCH] Do not raise StopIteration when calling pairwise with empty iterable Closes #12652 (grafted from bf2f33fe3adf63deae1162ab64f0a1c2cc43eee0) --HG-- branch : 6.0 --- modules/sale/sale_reporting.py | 2 +- modules/stock/stock_reporting_margin.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/sale/sale_reporting.py b/modules/sale/sale_reporting.py index 8df510254f..a8c9f7b9da 100644 --- a/modules/sale/sale_reporting.py +++ b/modules/sale/sale_reporting.py @@ -24,7 +24,7 @@ from trytond.i18n import lazy_gettext def pairwise(iterable): a, b = tee(iterable) - next(b) + next(b, None) return zip_longest(a, b) diff --git a/modules/stock/stock_reporting_margin.py b/modules/stock/stock_reporting_margin.py index ce5aef73f4..557d9fd58f 100644 --- a/modules/stock/stock_reporting_margin.py +++ b/modules/stock/stock_reporting_margin.py @@ -24,7 +24,7 @@ from trytond.transaction import Transaction def pairwise(iterable): a, b = tee(iterable) - next(b) + next(b, None) return zip_longest(a, b)