Bug #1707

Proc#call Raises ThreadError on 1.8 HEAD; LocalJumpError on Other Versions

Added by runpaint (Run Paint Run Run) almost 3 years ago. Updated about 1 year ago.

[ruby-core:24097]
Status:Closed Start date:07/01/2009
Priority:Normal Due date:
Assignee:- % Done:

100%

Category:core
Target version:Ruby 1.8.8
ruby -v:ruby 1.8.8dev (2009-06-28) [i686-linux]

Description

The code below raises a LocalJumpError on 1.8.6, 1.8.7, and 1.9 HEAD. It raises a ThreadError ("return can't jump across threads") on 1.8 HEAD.

    def some_method(&b) b end
    a_proc = Proc.new { return }
    res = some_method(&a_proc)
    res.call

Is this difference intentional? If so, why?

Versions
========

* ruby 1.8.6 (2009-06-08 patchlevel 369) [i686-linux]
* ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux]
* ruby 1.8.8dev (2009-06-28) [i686-linux]
* ruby 1.9.2dev (2009-06-27 trunk 23871) [i686-linux]

Associated revisions

Revision 23922
Added by nobu almost 3 years ago

* eval.c (PUSH_ANCHOR, POP_ANCHOR, rb_thread_start_0): separated anchors from PROT_THREAD. [ruby-core:24097]

Revision 23923
Added by nobu almost 3 years ago

* test/ruby/test_proc.rb (test_return_from_proc): test for [ruby-core:24097].

History

Updated by matz (Yukihiro Matsumoto) almost 3 years ago

Hi,

In message "Re: [ruby-core:24097] [Bug #1707] Proc#call Raises ThreadError on 1.8 HEAD; LocalJumpError on Other Versions"
    on Wed, 1 Jul 2009 01:07:46 +0900, Run Paint Run Run <redmine@ruby-lang.org> writes:

|The code below raises a LocalJumpError on 1.8.6, 1.8.7, and 1.9 HEAD. It raises a ThreadError ("return can't jump across threads") on 1.8 HEAD.
|
|    def some_method(&b) b end
|    a_proc = Proc.new { return }
|    res = some_method(&a_proc)
|    res.call
|
|Is this difference intentional? If so, why?

It's not intentional.

							matz.

Updated by nobu (Nobuyoshi Nakada) almost 3 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
Applied in changeset r23922.

Also available in: Atom PDF