diff Objects/methodobject.c @ 488:90f35fcf8ea0 legacy-trunk

Add "varargs" attribute.
author Guido van Rossum <guido@python.org>
date Mon, 16 Dec 1991 13:07:24 +0000
parents 1d4b0339b83d
children f710110cfd39
line wrap: on
line diff
--- a/Objects/methodobject.c	Mon Dec 16 13:06:34 1991 +0000
+++ b/Objects/methodobject.c	Mon Dec 16 13:07:24 1991 +0000
@@ -30,16 +30,18 @@
 
 typedef struct {
 	OB_HEAD
-	char *m_name;
-	method m_meth;
-	object *m_self;
+	char	*m_name;
+	method	m_meth;
+	object	*m_self;
+	int	m_varargs;
 } methodobject;
 
 object *
-newmethodobject(name, meth, self)
+newmethodobject(name, meth, self, varargs)
 	char *name; /* static string */
 	method meth;
 	object *self;
+	int varargs;
 {
 	methodobject *op = NEWOBJ(methodobject, &Methodtype);
 	if (op != NULL) {
@@ -48,6 +50,7 @@
 		if (self != NULL)
 			INCREF(self);
 		op->m_self = self;
+		op->m_varargs = varargs;
 	}
 	return (object *)op;
 }
@@ -74,6 +77,17 @@
 	return ((methodobject *)op) -> m_self;
 }
 
+int
+getvarargs(op)
+	object *op;
+{
+	if (!is_methodobject(op)) {
+		err_badcall();
+		return -1;
+	}
+	return ((methodobject *)op) -> m_varargs;
+}
+
 /* Methods (the standard built-in methods, that is) */
 
 static void
@@ -168,7 +182,8 @@
 		return listmethods(ml);
 	for (; ml->ml_name != NULL; ml++) {
 		if (strcmp(name, ml->ml_name) == 0)
-			return newmethodobject(ml->ml_name, ml->ml_meth, op);
+			return newmethodobject(ml->ml_name, ml->ml_meth,
+					op, ml->ml_varargs);
 	}
 	err_setstr(AttributeError, name);
 	return NULL;