Feature #2824

Backtrace from Singleton Classes is Unclear

Added by Run Paint Run Run almost 5 years ago. Updated almost 3 years ago.

[ruby-core:28368]
Status:Closed
Priority:Low
Assignee:-

Description

=begin
The backtrace from singleton classes needs a space between 'singleton' and 'class'.

$ ruby -e 'class << self; x; end'
-e:1:in singletonclass': undefined local variable or methodx' for #Class:#<Object:0x83efde8> (NameError)
from -e:1:in `'

However, more useful would be to indicate which object's singleton class raised the exception. This is particularly relevant for exceptions whose messages do not include the caller's #inspect output. For example, compare:

$ ruby -e 'class H; 1/0; end'
-e:1:in /': divided by 0 (ZeroDivisionError)
from -e:1:in
class:H'
from -e:1:in `'

$ ruby -e 'class << "c"; 1/0; end'
-e:1:in /': divided by 0 (ZeroDivisionError)
from -e:1:in
singletonclass'
from -e:1:in `'
=end

singleton-compile.c.patch Magnifier (475 Bytes) Run Paint Run Run, 09/02/2010 11:45 PM

Associated revisions

Revision 35079
Added by Akira Tanaka almost 3 years ago

  • compile.c: typo fix by Run Paint Run Run. [Bug #2824]

Revision 35079
Added by Akira Tanaka almost 3 years ago

  • compile.c: typo fix by Run Paint Run Run. [Bug #2824]

History

#1 Updated by Kazuhiro NISHIYAMA almost 5 years ago

  • Target version set to 2.0.0

=begin

=end

#2 Updated by Run Paint Run Run over 4 years ago

=begin
The attached fixes the typo; improving the error message appears to require knowledge of YARV internals.
=end

#3 Updated by Akira Tanaka almost 3 years ago

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

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


  • compile.c: typo fix by Run Paint Run Run. [Bug #2824]

Also available in: Atom PDF