summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-12-16 13:07:24 (GMT)
committerGuido van Rossum <guido@python.org>1991-12-16 13:07:24 (GMT)
commitc06022966f58b7130e0a8b7150d1955865c84dc8 (patch)
tree61b860da9f4a15dd879cc7bc1cd0395108e1fc92 /Objects
parent3ddee714d1d4473f8fa04a6d8356d3eafb695a50 (diff)
downloadcpython-c06022966f58b7130e0a8b7150d1955865c84dc8.zip
cpython-c06022966f58b7130e0a8b7150d1955865c84dc8.tar.gz
cpython-c06022966f58b7130e0a8b7150d1955865c84dc8.tar.bz2
Add "varargs" attribute.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/methodobject.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/Objects/methodobject.c b/Objects/methodobject.c
index 3ebdb37..98b70a6 100644
--- a/Objects/methodobject.c
+++ b/Objects/methodobject.c
@@ -30,16 +30,18 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
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 @@ newmethodobject(name, meth, self)
if (self != NULL)
INCREF(self);
op->m_self = self;
+ op->m_varargs = varargs;
}
return (object *)op;
}
@@ -74,6 +77,17 @@ getself(op)
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 @@ findmethod(ml, op, name)
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;