diff options
-rw-r--r-- | test/ruby/test_exception.rb | 11 | ||||
-rw-r--r-- | version.h | 6 | ||||
-rw-r--r-- | vm_insnhelper.c | 12 |
3 files changed, 20 insertions, 9 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index a6b707bcca..1a5f31ff0d 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -1019,4 +1019,15 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| } end; end + + def test_break_in_once + assert_separately([], "#{<<-"begin;"}\n#{<<~'end;'}") + begin; + obj = Object.new + def obj.try + /#{break}/o + end + assert_raise(LocalJumpError, /proc-closure/) {obj.try} + end; + end end @@ -1,10 +1,10 @@ #define RUBY_VERSION "2.4.2" -#define RUBY_RELEASE_DATE "2017-08-03" -#define RUBY_PATCHLEVEL 164 +#define RUBY_RELEASE_DATE "2017-08-04" +#define RUBY_PATCHLEVEL 165 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 8 -#define RUBY_RELEASE_DAY 3 +#define RUBY_RELEASE_DAY 4 #include "ruby/version.h" diff --git a/vm_insnhelper.c b/vm_insnhelper.c index b11c5a61e4..4fdeeb2e6e 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1039,13 +1039,13 @@ vm_throw_start(rb_thread_t *const th, rb_control_frame_t *const reg_cfp, enum ru while (escape_cfp < eocfp) { if (escape_cfp->ep == ep) { - const VALUE epc = escape_cfp->pc - escape_cfp->iseq->body->iseq_encoded; - const rb_iseq_t * const iseq = escape_cfp->iseq; - const struct iseq_catch_table * const ct = iseq->body->catch_table; - const int ct_size = ct->size; - int i; + const rb_iseq_t *const iseq = escape_cfp->iseq; + const VALUE epc = escape_cfp->pc - iseq->body->iseq_encoded; + const struct iseq_catch_table *const ct = iseq->body->catch_table; + unsigned int i; - for (i=0; i<ct_size; i++) { + if (!ct) break; + for (i=0; i < ct->size; i++) { const struct iseq_catch_table_entry * const entry = &ct->entries[i]; if (entry->type == CATCH_TYPE_BREAK && entry->start < epc && entry->end >= epc) { |