* Changed all copyright messages to include 1993.
* Stubs for faster implementation of local variables (not yet finished)
* Added function name to code object. Print it for code and function
objects. THIS MAKES THE .PYC FILE FORMAT INCOMPATIBLE (the version
number has changed accordingly)
* Print address of self for built-in methods
* New internal functions getattro and setattro (getattr/setattr with
string object arg)
* Replaced "dictobject" with more powerful "mappingobject"
* New per-type functio tp_hash to implement arbitrary object hashing,
and hashobject() to interface to it
* Added built-in functions hash(v) and hasattr(v, 'name')
* classobject: made some functions static that accidentally weren't;
added __hash__ special instance method to implement hash()
* Added proper comparison for built-in methods and functions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index a779ebb..ccf1b29 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -1,6 +1,6 @@
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
@@ -25,7 +25,7 @@
/* Function object implementation */
#include "allobjects.h"
-
+#include "compile.h"
#include "structmember.h"
typedef struct {
@@ -98,6 +98,17 @@
DEL(op);
}
+static object*
+func_repr(op)
+ funcobject *op;
+{
+ char buf[140];
+ sprintf(buf, "<function %.100s at %lx>",
+ getstringvalue(((codeobject*)(op->func_code))->co_name),
+ (long)op);
+ return newstringobject(buf);
+}
+
typeobject Functype = {
OB_HEAD_INIT(&Typetype)
0,
@@ -109,5 +120,5 @@
func_getattr, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
- 0, /*tp_repr*/
+ func_repr, /*tp_repr*/
};