Project

General

Profile

Backport #7185

requireしたファイルからのthrowをcatchするとNotImplementedErrorが起きる

Added by Anonymous almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
[ruby-dev:46234]

Description

はじめまして、yfujitaと申します.

以下の2つのファイルを用意して、./req.rb を実行するとエラーになります.
これは、1.9 以降はこういう記述はできなくなったという事なのでしょうか?

require される側(dep.rb)を途中で抜けるために使っていたのですが、
良い方法はないでしょうか?

==== ./dep.rb ====
#!/usr/local/bin/ruby

throw :extdep
==================

==== ./req.rb ====
#!/usr/local/bin/ruby
$:.unshift(".")

catch(:extdep){
require 'dep.rb'
}
==================

# ./req.rb
/usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require':
method
backtrace' called on unexpected T_NODE object (0x00000002337d20
flags=0x381c klass=0x0) (NotImplementedError)
from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require'
from ./req.rb:5:in
block in '
from ./req.rb:4:in catch'
from ./req.rb:4:in
'

# ruby -v
ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]

ruby 1.8.7 では正常に終了します.
# ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
# ./req.rb

ubuntu に入っているruby1.9.3p0でもエラーで終了します.
# ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
# ./req.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': method
backtrace' called on unexpected T_NODE object (0x000000011fce20
flags=0x381c klass=0x0) (NotImplementedError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require'
from ./req.rb:5:in
block in '
from ./req.rb:4:in catch'
from ./req.rb:4:in
'

  • 環境 1. Ubuntu 12.04 server 64 bit 仮想PC(Virtualbox) ruby 1.9.3p286

ruby1.9.3p286は、Ubuntu 12.04 server 上でコンパイルしたものです.
make test-all でいくつかエラーがありましたが無視して
インストールしてみたものです.

2.
Ubuntu 12.04 client 64 bit
実PC
ruby 1.9.3p0
ruby 1.8.7
どちらもubuntu付属のrubyです.

--
Yoshihiko Fujita

Associated revisions

Revision 2fe13f62
Added by nobu (Nobuyoshi Nakada) almost 7 years ago

vm.c: pass through thrown objects

  • vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects. [ruby-dev:46234] [Bug #7185]
  • vm_eval.c (rb_eval_cmd): if state is non-zero, val should be nil and rb_vm_jump_tag_but_local_jump() just jump tag.

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

Revision 37270
Added by nobu (Nobuyoshi Nakada) almost 7 years ago

vm.c: pass through thrown objects

  • vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects. [ruby-dev:46234] [Bug #7185]
  • vm_eval.c (rb_eval_cmd): if state is non-zero, val should be nil and rb_vm_jump_tag_but_local_jump() just jump tag.

Revision 37270
Added by nobu (Nobuyoshi Nakada) almost 7 years ago

vm.c: pass through thrown objects

  • vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects. [ruby-dev:46234] [Bug #7185]
  • vm_eval.c (rb_eval_cmd): if state is non-zero, val should be nil and rb_vm_jump_tag_but_local_jump() just jump tag.

Revision 37270
Added by nobu (Nobuyoshi Nakada) almost 7 years ago

vm.c: pass through thrown objects

  • vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects. [ruby-dev:46234] [Bug #7185]
  • vm_eval.c (rb_eval_cmd): if state is non-zero, val should be nil and rb_vm_jump_tag_but_local_jump() just jump tag.

Revision 37270
Added by nobu (Nobuyoshi Nakada) almost 7 years ago

vm.c: pass through thrown objects

  • vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects. [ruby-dev:46234] [Bug #7185]
  • vm_eval.c (rb_eval_cmd): if state is non-zero, val should be nil and rb_vm_jump_tag_but_local_jump() just jump tag.

Revision 37270
Added by nobu (Nobuyoshi Nakada) almost 7 years ago

vm.c: pass through thrown objects

  • vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects. [ruby-dev:46234] [Bug #7185]
  • vm_eval.c (rb_eval_cmd): if state is non-zero, val should be nil and rb_vm_jump_tag_but_local_jump() just jump tag.

Revision 37270
Added by nobu (Nobuyoshi Nakada) almost 7 years ago

vm.c: pass through thrown objects

  • vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects. [ruby-dev:46234] [Bug #7185]
  • vm_eval.c (rb_eval_cmd): if state is non-zero, val should be nil and rb_vm_jump_tag_but_local_jump() just jump tag.

Revision b91f5c75
Added by usa (Usaku NAKAMURA) almost 7 years ago

merge revision(s) 37270: [Backport #7185]

    * vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects.
      [ruby-dev:46234] [Bug #7185]

    * vm_eval.c (rb_eval_cmd): if state is non-zero, val should be nil and
      rb_vm_jump_tag_but_local_jump() just jump tag.

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

Revision 37551
Added by usa (Usaku NAKAMURA) almost 7 years ago

merge revision(s) 37270: [Backport #7185]

* vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects.
  [ruby-dev:46234] [Bug #7185]

* vm_eval.c (rb_eval_cmd): if state is non-zero, val should be nil and
  rb_vm_jump_tag_but_local_jump() just jump tag.

History

#1

Updated by nobu (Nobuyoshi Nakada) almost 7 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r37270.
, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


vm.c: pass through thrown objects

  • vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects. [ruby-dev:46234] [Bug #7185]
  • vm_eval.c (rb_eval_cmd): if state is non-zero, val should be nil and rb_vm_jump_tag_but_local_jump() just jump tag.
#2

Updated by nobu (Nobuyoshi Nakada) almost 7 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby master to Backport193
  • Status changed from Closed to Assigned
  • Assignee set to usa (Usaku NAKAMURA)
#3

Updated by usa (Usaku NAKAMURA) almost 7 years ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r37551.
, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 37270: [Backport #7185]

* vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects.
  [ruby-dev:46234] [Bug #7185]

* vm_eval.c (rb_eval_cmd): if state is non-zero, val should be nil and
  rb_vm_jump_tag_but_local_jump() just jump tag.

Also available in: Atom PDF