Skip to content

Commit

Permalink
Merge branch 'master' into fibers
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Gaynor committed Mar 19, 2013
2 parents bd82b75 + ee7431b commit 436e0ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion spec/tags/core/object/instance_of_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
fails:Object##instance_of? returns true if given class is object's class
fails:Object##instance_of? raises a TypeError if given an object that is not a Class nor a Module
4 changes: 4 additions & 0 deletions topaz/modules/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from topaz.objects.exceptionobject import W_ExceptionObject
from topaz.objects.procobject import W_ProcObject
from topaz.objects.stringobject import W_StringObject
from topaz.objects.classobject import W_ClassObject
from topaz.objects.moduleobject import W_ModuleObject


class Kernel(Module):
Expand Down Expand Up @@ -298,6 +300,8 @@ def method_is_kind_ofp(self, space, w_mod):

@moduledef.method("instance_of?")
def method_instance_of(self, space, w_mod):
if not isinstance(w_mod, W_ModuleObject):
raise space.error(space.w_TypeError, "class or module required")
return space.newbool(space.getnonsingletonclass(self) is w_mod)

@moduledef.method("eval")
Expand Down

0 comments on commit 436e0ee

Please sign in to comment.