diff options
author | Nobuyoshi Nakada <[email protected]> | 2024-02-26 10:48:54 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2024-02-26 11:56:38 +0900 |
commit | dc146babf47a84bbd1f176d766637d4a40327019 (patch) | |
tree | 512b035d89a224914fb10901ee20b14caac820e0 /complex.c | |
parent | a1ca96e1fdf4e234124bcff91d822584a6997833 (diff) |
[Bug #20296] Clear errinfo when `exception: false`
Diffstat (limited to 'complex.c')
-rw-r--r-- | complex.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -2323,8 +2323,11 @@ nucomp_convert(VALUE klass, VALUE a1, VALUE a2, int raise) return a1; /* should raise exception for consistency */ if (!k_numeric_p(a1)) { - if (!raise) - return rb_protect(to_complex, a1, NULL); + if (!raise) { + a1 = rb_protect(to_complex, a1, NULL); + rb_set_errinfo(Qnil); + return a1; + } return to_complex(a1); } } |