Project

General

Profile

Actions

Bug #6214

closed

warnings on inspect for Enumerator objects if $VERBOSE

Added by no6v (Nobuhiro IMAI) over 12 years ago. Updated over 12 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.0.0dev (2012-03-28 trunk 35155) [x86_64-linux]
Backport:
[ruby-dev:45449]

Description

Lazy なオブジェクトの inspect がわかりやすくなった反面、
$VERBOSE な時に警告が出るようです。

$ ruby -ve 'p "".bytes'
ruby 2.0.0dev (2012-03-28 trunk 35155) [x86_64-linux]
-e:1: warning: instance variable receiver not initialized
-e:1: warning: instance variable method not initialized
-e:1: warning: instance variable arguments not initialized
#<Enumerator: "":bytes>
$ ruby -ve 'p [].lazy'
ruby 2.0.0dev (2012-03-28 trunk 35155) [x86_64-linux]
-e:1: warning: instance variable arguments not initialized
#<Enumerator::Lazy: []>

xmpfilter を通す時に警告が表示されてちょっと困ります。

$ xmpfilter <(echo '[].lazy # =>')
[].lazy # => #<Enumerator::Lazy: []> # !> instance variable arguments not initialized


Files

no-warn-enum-inspect.patch (1.72 KB) no-warn-enum-inspect.patch no6v (Nobuhiro IMAI), 03/30/2012 10:50 PM

Updated by no6v (Nobuhiro IMAI) over 12 years ago

これらのインスタンス変数はスクリプト側からは見えないので、
警告は出なくてもよいのではないですかね。そういう方向で
パッチとテストを書いてみたので、見ていただけるとありがたいです。

Actions #2

Updated by nobu (Nobuyoshi Nakada) over 12 years ago

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

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


  • enumerator.c (inspect_enumerator): suppress uninitialized
    instance variable warnings. [ruby-dev:45449][Bug #6214]
    patched by no6v (Nobuhiro IMAI).
Actions

Also available in: Atom PDF

Like0
Like0Like0