Ruby 2.0抛出“[BUG]堆栈一致性错误”

我正在关注 Ruby Koans和about_proxy_object_project.rb中的练习,这里有一些代码
class Proxy
  def initialize(target_object)
    @object = target_object
  end

  # This method was added by me
  def method_missing(method_name,*args,&block)
    @object.send method_name
  end
end

这被称为:

def test_tv_methods_still_perform_their_function
  tv = Proxy.new(Television.new) # Television is a class with a :channel attr_accessor and a power method

  tv.channel = 10
  tv.power

  assert_equal 10,tv.channel
  assert tv.on?
end

问题是,tv.channel = 10行正在“破解”解释器并抛出:

[BUG] Stack consistency error (sp: 53,bp: 54)
ruby 2.0.0p0
(...)    
full stack trace follows

我在Ruby 1.9.3上尝试了相同的代码并且它正在运行.我正在使用Ruby 2.0.0-p195.

那么,这是一个错误/错误吗?或者我正在做一些可怕的错误

解决方法

是.这是ruby 2.0.0p195(2013-05-14修订版40734)[x86_64-linux]中的Ruby错误.在堆栈跟踪结束时,它说:
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

您应该将此报告给Ruby核心.请为Ruby社区这样做.

正如matt指出的那样,它在Ruby 2.0.0p247中得到了修复.

我没有看到你做错了什么.

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...