From a5a12ecf21493f9ec821f473507ad5e872ef4465 Mon Sep 17 00:00:00 2001 From: pk-2000 <63214388+pk-2000@users.noreply.github.com> Date: Wed, 1 Sep 2021 00:09:15 +0300 Subject: [PATCH] Rational errors fix - Better debug information on float errors (lines 231 and 251). - line 246 fixes ruby rational errors --- binding-mri/binding-util.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/binding-mri/binding-util.h b/binding-mri/binding-util.h index 1b758be..293996b 100644 --- a/binding-mri/binding-util.h +++ b/binding-mri/binding-util.h @@ -228,7 +228,7 @@ rb_float_arg(VALUE arg, double *out, int argPos = 0) break; default: - rb_raise(rb_eTypeError, "Argument %d: Expected float", argPos); + rb_raise(rb_eTypeError, "Argument %d: Expected float(got 0x%x)", argPos, rb_type(arg)); } } @@ -243,11 +243,12 @@ rb_int_arg(VALUE arg, int *out, int argPos = 0) break; case RUBY_T_FIXNUM : + case RUBY_T_RATIONAL : *out = FIX2INT(arg); break; default: - rb_raise(rb_eTypeError, "Argument %d: Expected fixnum", argPos); + rb_raise(rb_eTypeError, "Argument %d: Expected fixnum(got 0x%x)", argPos, rb_type(arg)); } } -- 2.43.0