summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-08 10:10:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-08 10:10:28 +0000
commita7c32bf81d3391cfb78cfda278f469717d0fb794 (patch)
tree61b180f9a469615991e3bb05e1124fa67c4dbbe0 /error.c
parentabbd115cae8f6db1bfe1c349ed6f928ac96c6622 (diff)
* error.c (rb_check_type): rejects typed data.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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;