Bug #7213

Namespace regression problem in RSpec from 1.9.2 to 1.9.3

Added by Alexander E. Fischer over 1 year ago. Updated over 1 year ago.

[ruby-core:48208]
Status:Rejected
Priority:Normal
Assignee:Shugo Maeda
Category:-
Target version:2.0.0
ruby -v:1.9.3 Backport:

Description

This article describes a bug which appeared in 1.9.3: "Including namespace module through RSpec config in Ruby 1.9.3":http://stackoverflow.com/questions/13042298/including-namespace-module-through-rspec-config-in-ruby-1-9-3

Some people believe that it could be related to #3422 which seemed to introduce regression but it wasn't sure if this regression was wanted or not.

History

#1 Updated by Yusuke Endoh over 1 year ago

  • Status changed from Open to Assigned
  • Assignee set to Shugo Maeda
  • Target version set to 2.0.0

If I recall, this is an intentional change since 1.9.3.
Shugo-san, could you check give him a reference to the discussion and close this ticket?

Yusuke Endoh mame@tsg.ne.jp

#2 Updated by Shugo Maeda over 1 year ago

  • Assignee changed from Shugo Maeda to Yusuke Endoh

mame (Yusuke Endoh) wrote:

If I recall, this is an intentional change since 1.9.3.
Shugo-san, could you check give him a reference to the discussion and close this ticket?

Do you mean Bug #4536?
It seems that foobar_spec.rb fails even if the fix of #4536 (r31215) is reverted.

Or do you mean another issue?

I don't know rspec well, but the comment of this ticket stated that this issue is related to #3422, and
I don't know anything about #3422.

#3 Updated by Yusuke Endoh over 1 year ago

  • Status changed from Assigned to Rejected
  • Assignee changed from Yusuke Endoh to Shugo Maeda

I meant your answers in these tickets:

https://bugs.ruby-lang.org/issues/6838
https://bugs.ruby-lang.org/issues/5777

As far as I know, #instance_eval with block changed constant lookup scope in 1.9.2, but it has stopped since 1.9.3.
The rspec behavior looks affected by this spec change.

I'm closing this ticket, but please tell me if I'm wrong.

Thank you,

Yusuke Endoh mame@tsg.ne.jp

#4 Updated by Shugo Maeda over 1 year ago

mame (Yusuke Endoh) wrote:

I meant your answers in these tickets:

https://bugs.ruby-lang.org/issues/6838
https://bugs.ruby-lang.org/issues/5777

As far as I know, #instance_eval with block changed constant lookup scope in 1.9.2, but it has stopped since 1.9.3.
The rspec behavior looks affected by this spec change.

In 1.9.2, constant lookup in instanceeval or moduleeval had already been reverted to the behavior of 1.8,
but there was a bug (#4536) in 1.9.2, and the bug was fixed in 1.9.3.

So I suspected that the fix of #4536 is related to this issue, but foobar_spec.rb fails even if the fix is reverted.

Anyway, the current behavior is intended. The following code illustrates why foobar_spec.rb fails in 1.9.3.

module Foo
X = 1
end

o = Object.new
o.extend(Foo)
o.instance_eval {
p X
}

This code prints 1 in 1.9.2, but raises a NameError in 1.8 and 1.9.3.
I don't know when this bug of 1.9.2 was fixed.

Also available in: Atom PDF