Added 1995 to copyright message.

floatobject.c: fix hash().
methodobject.c: support METH_FREENAME flag bit.
This commit is contained in:
Guido van Rossum 1995-01-04 19:07:38 +00:00
parent 5799b52008
commit 6610ad9d6b
19 changed files with 50 additions and 47 deletions

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved
@ -212,7 +212,7 @@ float_hash(v)
} }
else { else {
fractpart = frexp(fractpart, &expo); fractpart = frexp(fractpart, &expo);
fractpart = fractpart*4294967296.0; /* 2**32 */ fractpart = fractpart*2147483648.0; /* 2**31 */
x = (long) (intpart + fractpart) ^ expo; /* Rather arbitrary */ x = (long) (intpart + fractpart) ^ expo; /* Rather arbitrary */
} }
if (x == -1) if (x == -1)

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved
@ -33,15 +33,15 @@ typedef struct {
char *m_name; char *m_name;
method m_meth; method m_meth;
object *m_self; object *m_self;
int m_varargs; int m_flags;
} methodobject; } methodobject;
object * object *
newmethodobject(name, meth, self, varargs) newmethodobject(name, meth, self, flags)
char *name; /* static string */ char *name;
method meth; method meth;
object *self; object *self;
int varargs; int flags;
{ {
methodobject *op = NEWOBJ(methodobject, &Methodtype); methodobject *op = NEWOBJ(methodobject, &Methodtype);
if (op != NULL) { if (op != NULL) {
@ -50,7 +50,7 @@ newmethodobject(name, meth, self, varargs)
if (self != NULL) if (self != NULL)
INCREF(self); INCREF(self);
op->m_self = self; op->m_self = self;
op->m_varargs = varargs; op->m_flags = flags;
} }
return (object *)op; return (object *)op;
} }
@ -85,7 +85,7 @@ getvarargs(op)
err_badcall(); err_badcall();
return -1; return -1;
} }
return ((methodobject *)op) -> m_varargs; return ((methodobject *)op) -> m_flags & METH_VARARGS;
} }
/* Methods (the standard built-in methods, that is) */ /* Methods (the standard built-in methods, that is) */
@ -96,6 +96,8 @@ meth_dealloc(m)
{ {
if (m->m_self != NULL) if (m->m_self != NULL)
DECREF(m->m_self); DECREF(m->m_self);
if (m->m_flags & METH_FREENAME)
free(m->m_name);
free((char *)m); free((char *)m);
} }
@ -199,8 +201,9 @@ findmethod(ml, op, name)
return listmethods(ml); return listmethods(ml);
for (; ml->ml_name != NULL; ml++) { for (; ml->ml_name != NULL; ml++) {
if (strcmp(name, ml->ml_name) == 0) if (strcmp(name, ml->ml_name) == 0)
return newmethodobject(ml->ml_name, ml->ml_meth, return newmethodobject(ml->ml_name, ml->ml_meth, op,
op, ml->ml_varargs); ml->ml_varargs ?
METH_VARARGS : 0);
} }
err_setstr(AttributeError, name); err_setstr(AttributeError, name);
return NULL; return NULL;

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved

View file

@ -1,6 +1,6 @@
/*********************************************************** /***********************************************************
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
Amsterdam, The Netherlands. The Netherlands.
All Rights Reserved All Rights Reserved