summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'error.c')
-rw-r--r--error.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/error.c b/error.c
index c3738db856..c4f4938cc6 100644
--- a/error.c
+++ b/error.c
@@ -282,12 +282,14 @@ rb_check_type(VALUE x, int t)
const struct types *type = builtin_types;
const struct types *const typeend = builtin_types +
sizeof(builtin_types) / sizeof(builtin_types[0]);
+ int xt;
if (x == Qundef) {
rb_bug("undef leaked to the Ruby space");
}
- if (TYPE(x) != t) {
+ xt = TYPE(x);
+ if (xt != t || (xt == T_DATA && RTYPEDDATA_P(x))) {
while (type < typeend) {
if (type->type == t) {
const char *etype;