diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-12 05:02:58 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-12 05:02:58 +0000 |
commit | 62c17a2f21b47243071075cbef37fe72b6ecd0ff (patch) | |
tree | 100d361f2c1256e4d29691fd2434d1fe5682273a /complex.c | |
parent | 52a97e36d09ae15800c2a52094759c18e7be4ee0 (diff) |
No TypeError at nil if exception: false
[ruby-core:91021] [Bug #15525]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'complex.c')
-rw-r--r-- | complex.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1943,8 +1943,10 @@ to_complex(VALUE val) static VALUE nucomp_convert(VALUE klass, VALUE a1, VALUE a2, int raise) { - if (NIL_P(a1) || NIL_P(a2)) + if (NIL_P(a1) || NIL_P(a2)) { + if (!raise) return Qnil; rb_raise(rb_eTypeError, "can't convert nil into Complex"); + } if (RB_TYPE_P(a1, T_STRING)) { a1 = string_to_c_strict(a1, raise); |