summaryrefslogtreecommitdiffstats
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
commit8cbb2a107ce9c1bba08008c160e157f266cbf0be (patch)
tree61b180f9a469615991e3bb05e1124fa67c4dbbe0 /error.c
parent56d9188439180f296bd5f98b25c5e5d0b8e841ec (diff)
downloadruby-8cbb2a107ce9c1bba08008c160e157f266cbf0be.tar.gz
ruby-8cbb2a107ce9c1bba08008c160e157f266cbf0be.tar.xz
ruby-8cbb2a107ce9c1bba08008c160e157f266cbf0be.zip
* error.c (rb_check_type): rejects typed data.
git-svn-id: http://svn.ruby-lang.org/repos/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 c3738db85..c4f4938cc 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;