[#45530] [ruby-trunk - Feature #6311][Open] memmem()によるrb_memsearch()の高速化 — "Glass_saga (Masaki Matsushita)" <glass.saga@...>

12 messages 2012/04/17

[#45554] [ruby-trunk - Bug #6344][Open] 1.9.3 p125, p194 ruby causes SEGV with test_massign.rb on ppc/ppc64 — "mtasaka (Mamoru Tasaka)" <mtasaka@...>

14 messages 2012/04/23

[ruby-dev:45522] [ruby-trunk - Bug #6301] irb 起動後に conf.debug_level を変更するとエラーになる

From: "sho-h (Sho Hashimoto)" <sho-h@...>
Date: 2012-04-16 14:38:27 UTC
List: ruby-dev #45522
Issue #6301 has been updated by sho-h (Sho Hashimoto).

File irb_debug_level.patch added

すみません。昨日は気づきませんでしたが、conf.debug_level は irb の起動後に再度代入するまでは効いていないようでした。

$ irb
> RubyLex.debug_level
 => 0
> conf.debug_level
 => 1
> conf.debug_level = 1
NoMethodError: undefined method `debug_level=' for IRB::SLex:Class
	from /home/sho-h/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/context.rb:245:in `debug_level='
        ...(省略)...

> conf.debug_level
MATCH: start : #<RubyLex:0x00000000f613a0 ...(省略)...
 => 1

> RubyLex.debug_level
MATCH: start : #<RubyLex:0x00000001a85470 ...(省略)...
 => 1

昨日の提案の修正に加えて以下が必要なのではないかと思いました。

* IRB.conf[:DEBUG_LEVEL] のデフォルト値を 0 に揃える(現状の実際の動作を維持)
* lib/irb/init.rb で conf.debug_level の値を反映させる

----------------------------------------
Bug #6301: irb 起動後に conf.debug_level を変更するとエラーになる
https://bugs.ruby-lang.org/issues/6301#change-25938

Author: sho-h (Sho Hashimoto)
Status: Open
Priority: Normal
Assignee: keiju (Keiju Ishitsuka)
Category: lib
Target version: 
ruby -v: ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]


$ irb --irb_debug <数字> などでは問題ありませんが、irb の起動後に conf.debug_level を設定するとエラーになるようです。(1.9.3-p125 で確認しましたが、trunk でも同様のようです)

> conf.debug_level = "1"
NoMethodError: undefined method `debug_level=' for IRB::SLex:Class
	from /home/sho-h/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/context.rb:245:in `debug_level='

IRB::SLex.debug_level を代入するのを止めるか、debug_level を追加するのがよいのではないかと思いました。

--- lib/irb/context.rb  (revision 35336)
+++ lib/irb/context.rb  (working copy)
@@ -242,7 +242,6 @@
     def debug_level=(value)
       @debug_level = value
       RubyLex.debug_level = value
-      SLex.debug_level = value
     end
 
     def debug?



-- 
http://bugs.ruby-lang.org/

In This Thread