merge revision(s) dd28c55a7c: [Backport #19445]

[Bug#19445] Fix keyword splat in enumerator

	Extracted arguments do not have keyword hash to splat.
	---
	 numeric.c                 | 2 +-
	 test/ruby/test_numeric.rb | 3 +++
	 2 files changed, 4 insertions(+), 1 deletion(-)
This commit is contained in:
NARUSE, Yui 2023-03-08 12:02:22 +09:00
parent 4d75035e17
commit 59eb18037f
3 changed files with 5 additions and 2 deletions

View file

@ -3056,7 +3056,7 @@ num_step(int argc, VALUE *argv, VALUE from)
num_step_size, from, to, step, FALSE); num_step_size, from, to, step, FALSE);
} }
return SIZED_ENUMERATOR(from, 2, ((VALUE [2]){to, step}), num_step_size); return SIZED_ENUMERATOR_KW(from, 2, ((VALUE [2]){to, step}), num_step_size, FALSE);
} }
desc = num_step_scan_args(argc, argv, &to, &step, TRUE, FALSE); desc = num_step_scan_args(argc, argv, &to, &step, TRUE, FALSE);

View file

@ -324,6 +324,9 @@ class TestNumeric < Test::Unit::TestCase
e = 1.step(10, {by: "1"}) e = 1.step(10, {by: "1"})
assert_raise(TypeError) {e.next} assert_raise(TypeError) {e.next}
assert_raise(TypeError) {e.size} assert_raise(TypeError) {e.size}
e = 1.step(to: "10")
assert_raise(ArgumentError) {e.next}
assert_raise(ArgumentError) {e.size}
assert_equal(bignum*2+1, (-bignum).step(bignum, 1).size) assert_equal(bignum*2+1, (-bignum).step(bignum, 1).size)
assert_equal(bignum*2, (-bignum).step(bignum-1, 1).size) assert_equal(bignum*2, (-bignum).step(bignum-1, 1).size)

View file

@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 1 #define RUBY_VERSION_TEENY 1
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
#define RUBY_PATCHLEVEL 36 #define RUBY_PATCHLEVEL 37
#include "ruby/version.h" #include "ruby/version.h"
#include "ruby/internal/abi.h" #include "ruby/internal/abi.h"