From c60a451c7b5bda63cd933f0ef2cc4bda4bc8f316 Mon Sep 17 00:00:00 2001 From: Marc-Andre Lafortune Date: Tue, 5 Mar 2024 17:33:03 -0300 Subject: [PATCH] Fix Enumerator.product.size. See https://bugs.ruby-lang.org/issues/20325 --- lib/backports/3.2.0/enumerator/product.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/backports/3.2.0/enumerator/product.rb b/lib/backports/3.2.0/enumerator/product.rb index 87337ab6..c6268242 100644 --- a/lib/backports/3.2.0/enumerator/product.rb +++ b/lib/backports/3.2.0/enumerator/product.rb @@ -56,7 +56,7 @@ def size @__enums.each do |enum| return nil unless enum.respond_to?(:size) size = enum.size - return size if size == nil || size == Float::INFINITY + return size if size == nil || size == Float::INFINITY || size == 0 return nil unless size.is_a?(Integer) total_size *= size end