Project

General

Profile

Bug #13090

Cannot use return statement in lambdas using instance_eval (MRI 2.4)

Added by decuplet (Nikita Shilnikov) over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
[ruby-core:78917]

Description

Hello,

I'm pretty sure I've found a bug after running specs for dry-initializer gem on MRI 2.4.
I managed to find the minimal code to reproduce the issue:

MRI 2.3.3

$ ruby -e "instance_eval(&lambda { |_| return })"
$

MRI 2.4.0-p0

$ ruby -e "instance_eval(&lambda { |_| return })"
-e:1:in `block in <main>': unexpected return (LocalJumpError)
    from -e:1:in `instance_eval'
    from -e:1:in `<main>'

I think lambda has been converted to an ordinary proc, but I didn't check it.

Best regards,
Nikita


Related issues

Related to Ruby master - Feature #12628: change block/env structsClosedActions

Associated revisions

Revision 91587f6b
Added by nobu (Nobuyoshi Nakada) over 2 years ago

vm.c: fix return in lambda

  • vm.c (invoke_block_from_c_splattable): pass lambda-ness.

  • vm_eval.c (yield_under): invoke lambda proc properly.
    [ruby-core:78917] [Bug #13090]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 57240
Added by nobu (Nobuyoshi Nakada) over 2 years ago

vm.c: fix return in lambda

  • vm.c (invoke_block_from_c_splattable): pass lambda-ness.

  • vm_eval.c (yield_under): invoke lambda proc properly.
    [ruby-core:78917] [Bug #13090]

Revision 57240
Added by nobu (Nobuyoshi Nakada) over 2 years ago

vm.c: fix return in lambda

  • vm.c (invoke_block_from_c_splattable): pass lambda-ness.

  • vm_eval.c (yield_under): invoke lambda proc properly.
    [ruby-core:78917] [Bug #13090]

Revision 57240
Added by nobu (Nobuyoshi Nakada) over 2 years ago

vm.c: fix return in lambda

  • vm.c (invoke_block_from_c_splattable): pass lambda-ness.

  • vm_eval.c (yield_under): invoke lambda proc properly.
    [ruby-core:78917] [Bug #13090]

Revision 30257ef4
Added by naruse (Yui NARUSE) over 2 years ago

merge revision(s) 57240: [Backport #13090]

    vm.c: fix return in lambda

    * vm.c (invoke_block_from_c_splattable): pass lambda-ness.

    * vm_eval.c (yield_under): invoke lambda proc properly.
      [ruby-core:78917] [Bug #13090]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 57847
Added by naruse (Yui NARUSE) over 2 years ago

merge revision(s) 57240: [Backport #13090]

vm.c: fix return in lambda

* vm.c (invoke_block_from_c_splattable): pass lambda-ness.

* vm_eval.c (yield_under): invoke lambda proc properly.
  [ruby-core:78917] [Bug #13090]

History

#1

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN to 2.2: DONTNEED, 2.3: DONTNEED, 2.4: REQUIRED
  • Description updated (diff)
#3

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Status changed from Open to Closed

Applied in changeset r57240.


vm.c: fix return in lambda

  • vm.c (invoke_block_from_c_splattable): pass lambda-ness.

  • vm_eval.c (yield_under): invoke lambda proc properly.
    [ruby-core:78917] [Bug #13090]

Updated by naruse (Yui NARUSE) over 2 years ago

  • Backport changed from 2.2: DONTNEED, 2.3: DONTNEED, 2.4: REQUIRED to 2.2: DONTNEED, 2.3: DONTNEED, 2.4: DONE

ruby_2_4 r57847 merged revision(s) 57240.

Also available in: Atom PDF