diff --git a/spec/tags/core/objectspace/each_object_tags.txt b/spec/tags/core/objectspace/each_object_tags.txt deleted file mode 100644 index 1ef726800..000000000 --- a/spec/tags/core/objectspace/each_object_tags.txt +++ /dev/null @@ -1,3 +0,0 @@ -fails:ObjectSpace.each_object calls the block once for each living, non-immediate object in the Ruby process -fails:ObjectSpace.each_object calls the block once for each class, module in the Ruby process -fails:returns an enumerator if not given a block diff --git a/topaz/modules/objectspace.py b/topaz/modules/objectspace.py index 6931531ba..5758a2e6e 100644 --- a/topaz/modules/objectspace.py +++ b/topaz/modules/objectspace.py @@ -23,6 +23,8 @@ class ObjectSpace(Module): @moduledef.function("each_object") def method_each_object(self, space, w_mod, block): + if block is None: + return space.send(self, space.newsymbol("enum_for"), [space.newsymbol("each_object"), w_mod], block) match_w = [] roots = [gcref for gcref in rgc.get_rpy_roots() if gcref] pending = roots[:] @@ -37,3 +39,4 @@ def method_each_object(self, space, w_mod, block): clear_gcflag_extra(roots) for w_obj in match_w: space.invoke_block(block, [w_obj]) + return space.newint(len(match_w))