summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gc.c b/gc.c
index 01f59dac94..a34a3238a2 100644
--- a/gc.c
+++ b/gc.c
@@ -1415,8 +1415,8 @@ add_final(os, block)
VALUE os, block;
{
rb_warn("ObjectSpace::add_finalizer is deprecated; use define_finalizer");
- if (!rb_obj_is_kind_of(block, rb_cBlock)) {
- rb_raise(rb_eArgError, "wrong type argument %s (Block required)",
+ if (!rb_respond_to(block, rb_intern("call"))) {
+ rb_raise(rb_eArgError, "wrong type argument %s (should be callable)",
rb_obj_classname(block));
}
rb_ary_push(finalizers, block);
@@ -1471,8 +1471,8 @@ define_final(argc, argv, os)
if (argc == 1) {
block = rb_block_new();
}
- else if (!rb_obj_is_kind_of(block, rb_cBlock)) {
- rb_raise(rb_eArgError, "wrong type argument %s (Block required)",
+ else if (!rb_respond_to(block, rb_intern("call"))) {
+ rb_raise(rb_eArgError, "wrong type argument %s (should be callable)",
rb_obj_classname(block));
}
need_call_final = 1;