From 68b5f14d536c1a81c63412a9f3701380c9bc116c Mon Sep 17 00:00:00 2001 From: Kenta Murata Date: Wed, 16 Sep 2020 19:27:16 +0900 Subject: Fix assertion failed in Complex.polar without NDEBUG (#3551) Fixes [Bug #17172]. --- complex.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'complex.c') diff --git a/complex.c b/complex.c index b8dd6169ae..4100fac082 100644 --- a/complex.c +++ b/complex.c @@ -732,6 +732,14 @@ nucomp_s_polar(int argc, VALUE *argv, VALUE klass) nucomp_real_check(arg); break; } + if (RB_TYPE_P(abs, T_COMPLEX)) { + get_dat1(abs); + abs = dat->real; + } + if (RB_TYPE_P(arg, T_COMPLEX)) { + get_dat1(arg); + arg = dat->real; + } return f_complex_polar(klass, abs, arg); } -- cgit v1.2.3