Skip to content
Permalink
Browse files

Fixed #562 -- when trying to reopen a module, only look in the local …

…scope, not any parent scopes.
  • Loading branch information
Alex Gaynor
Alex Gaynor committed Apr 10, 2013
1 parent d3a943b commit 36a295dd945d1e171f43fe742efdb1c13cd25a4a
Showing with 15 additions and 1 deletion.
  1. +14 −0 tests/test_interpreter.py
  2. +1 −1 topaz/interpreter.py
@@ -623,6 +623,20 @@ class X
end
""")

def test_module_reopen_scope(self, space):
w_res = space.execute("""
class Foo
end
module Bar
module Foo
end
end
return Foo, Bar::Foo
""")
[w_cls1, w_cls2] = space.listview(w_res)
assert w_cls1 is not w_cls2

def test_singleton_method(self, space):
w_res = space.execute("""
def Array.hello
@@ -392,7 +392,7 @@ def BUILD_MODULE(self, space, bytecode, frame, pc):
w_scope = frame.pop()

name = space.symbol_w(w_name)
w_mod = w_scope.find_const(space, name)
w_mod = w_scope.find_local_const(space, name)

if w_mod is None:
w_mod = space.newmodule(name, w_scope=w_scope)

0 comments on commit 36a295d

Please sign in to comment.