mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[Bug #20296] Clear errinfo when exception: false
This commit is contained in:
parent
a1ca96e1fd
commit
dc146babf4
2 changed files with 21 additions and 23 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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue