Project

General

Profile

Actions

Bug #6502

closed

include Syslog

Added by mame (Yusuke Endoh) almost 12 years ago. Updated about 11 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.0.0dev (2012-05-26 trunk 35811) [i686-linux]
Backport:
[ruby-dev:45682]

Description

knu さん

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

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

具体的には、以下のように 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

Updated by knu (Akinori MUSHA) about 11 years ago

  • Target version changed from 2.0.0 to 2.1.0

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

Actions #2

Updated by knu (Akinori MUSHA) about 11 years 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]
Actions

Also available in: Atom PDF

Like0
Like0Like0