diff --git a/ChangeLog b/ChangeLog index 2c8032ec1e..5f474db4b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Jul 10 11:35:29 2011 Yusuke Endoh + + * parse.y (reduce_nodes_gen): NODE_RETURN in rescue body must not be + reduced when there is an else clause. This caused bizarre behavior + in [Bug #4473] [ruby-core:35629] [ruby-core:37884]. + Sun Jul 10 09:46:14 2011 Masaya Tarui * range.c (range_max): fix behavior with excluded end value. diff --git a/parse.y b/parse.y index 9769bb9887..ffa649b7af 100644 --- a/parse.y +++ b/parse.y @@ -8713,6 +8713,10 @@ reduce_nodes_gen(struct parser_params *parser, NODE **body) if (!subnodes(nd_head, nd_resq)) goto end; break; case NODE_RESCUE: + if (node->nd_else) { + body = &node->nd_resq; + break; + } if (!subnodes(nd_head, nd_resq)) goto end; break; default: