diff --git a/src/module_support.c b/src/module_support.c
index 5ade002b2718538a34fccedb7e7c2971b9bdd8c0..446c4ee020c95b55b85373c248d63c237a57ab7f 100644
--- a/src/module_support.c
+++ b/src/module_support.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: module_support.c,v 1.72 2008/04/01 08:02:10 mast Exp $
+|| $Id: module_support.c,v 1.73 2008/04/14 10:05:14 grubba Exp $
 */
 
 #include "global.h"
@@ -183,6 +183,7 @@ PMOD_EXPORT void check_all_args(const char *fnname, int args, ... )
 #define ARGS_SHORT	-2 /* At end of args but not fmt and has not passed a period. */
 #define ARGS_LONG	-3 /* At end of fmt but not args. */
 #define ARGS_NUL_IN_STRING -4	/* 8 bit string got embedded NUL. */
+#define ARGS_SUBTYPED_OBJECT -5	/* An object with a subtype. */
 /* Positive values: Stopped at arg with invalid type. The value is the
  * format letter for the expected type. */
 
@@ -413,6 +414,10 @@ static int va_get_args_2(struct svalue *s,
       /* FALL THROUGH */
     case 'o':
       if(s->type != T_OBJECT) goto type_err;
+      if (s->subtype) {
+	*info = ARGS_SUBTYPED_OBJECT;
+	return ret;
+      }
       *cast_arg(ptr, struct object **)=s->u.object;
       break;
 
@@ -518,6 +523,12 @@ PMOD_EXPORT void get_all_args(const char *fname, INT32 args,
 	ret+1, fname);
       /* NOT REACHED */
 
+    case ARGS_SUBTYPED_OBJECT:
+      bad_arg_error(fname, sp-args, args, ret+1, "object",
+		    sp+ret-args,
+		    "Subtyped objects are not supported.\n");
+      /* NOT_REACHED */
+
     case ARGS_SHORT:
     default: {
       char *expected_type;