Bug #6502

include Syslog

Added by Yusuke Endoh almost 2 years ago. Updated about 1 year ago.

[ruby-dev:45682]
Status:Closed
Priority:Low
Assignee:Akinori MUSHA
Category:-
Target version:2.1.0
ruby -v:ruby 2.0.0dev (2012-05-26 trunk 35811) [i686-linux] Backport:

Description

knu さん

http://d.hatena.ne.jp/nagachika/20120521#r35737

で指摘されていますが、Syslog#inspect が rbdefinemodulefunction なのは意図的でしょうか。
rb
definesingletonmethod の方が適切なように思います。

具体的には、以下のように include したクラスが inspect できません。

$ ruby -rsyslog -e 'class A; include Syslog; end; p A.new'
-e:1:in inspect': wrong argument type A (expected Module) (TypeError)
from -e:1:in
p'
from -e:1:in `'

r35737 前はこのコードで SEGV していたようなので、改善されたのは確かです。

Yusuke Endoh mame@tsg.ne.jp

Associated revisions

Revision 39316
Added by Akinori MUSHA about 1 year ago

Remove Syslog#inspect and have only Syslog.inspect.

  • ext/syslog/syslog.c (Init_syslog): Define inspect as a singleton method and remove it as an instance method. [Bug #6502]

History

#1 Updated by Akinori MUSHA about 1 year ago

  • Target version changed from 2.0.0 to 2.1.0

これ、Syslogをクラスからモジュールに変えた大昔のコードですね。
もはやSyslogは継承できないのでそれが正しそうです。2.1.0までに直します。

#2 Updated by Akinori MUSHA about 1 year ago

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

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


Remove Syslog#inspect and have only Syslog.inspect.

  • ext/syslog/syslog.c (Init_syslog): Define inspect as a singleton method and remove it as an instance method. [Bug #6502]

Also available in: Atom PDF