Project

General

Profile

Actions

Backport #7185

closed

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

Added by Anonymous over 11 years ago. Updated over 11 years ago.

Status:
Closed
[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 '

  • 環境

Ubuntu 12.04 server 64 bit
仮想PC(Virtualbox)
ruby 1.9.3p286

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

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

--
Yoshihiko Fujita

Actions #1

Updated by nobu (Nobuyoshi Nakada) over 11 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.
Actions #2

Updated by nobu (Nobuyoshi Nakada) over 11 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)
Actions #3

Updated by usa (Usaku NAKAMURA) over 11 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.
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0