summaryrefslogtreecommitdiff
path: root/complex.c
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2024-07-15 09:50:14 +0900
committernagachika <nagachika@ruby-lang.org>2024-07-15 09:50:14 +0900
commit90f4c5dc73af3fff76500dd4223792a6d9f58636 (patch)
tree76455e0344fcf2608bce117271533bc294b2b917 /complex.c
parenta54c717c7a74b91a3cdf20742c355e3ea42052d1 (diff)
merge revision(s) dc146babf47a84bbd1f176d766637d4a40327019, f23d5028059078a346efc977287b669d494a5a3f, a0f7de814ae5c299d6ce99bed5fb308a05d50ba0: [Backport #20296]
[Bug #20296] Clear errinfo when `exception: false` [Bug #20296] Refine the test [Bug #20296] Fix the default assertion message
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/complex.c b/complex.c
index 57962f9013..a227cb0a58 100644
--- a/complex.c
+++ b/complex.c
@@ -2116,8 +2116,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);
}
}