diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2001-02-11 01:12:53 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2001-02-11 01:12:53 (GMT) |
commit | 3f49e4d06442a53510af6006145f9fe6d2ed921e (patch) | |
tree | f0fc3cf52d5b14ef5b6d7379bae02faf1413bc1c /Mac/Modules | |
parent | 8a38714ba05a3734f812bb1bbebdc527732a22bc (diff) | |
download | cpython-3f49e4d06442a53510af6006145f9fe6d2ed921e.zip cpython-3f49e4d06442a53510af6006145f9fe6d2ed921e.tar.gz cpython-3f49e4d06442a53510af6006145f9fe6d2ed921e.tar.bz2 |
Oops, repr didn't allocate the memory it used...
Diffstat (limited to 'Mac/Modules')
-rw-r--r-- | Mac/Modules/win/Winmodule.c | 8 | ||||
-rw-r--r-- | Mac/Modules/win/winsupport.py | 12 |
2 files changed, 19 insertions, 1 deletions
diff --git a/Mac/Modules/win/Winmodule.c b/Mac/Modules/win/Winmodule.c index 0ff5733..0aa6e11 100644 --- a/Mac/Modules/win/Winmodule.c +++ b/Mac/Modules/win/Winmodule.c @@ -2310,7 +2310,13 @@ static int WinObj_compare(self, other) return 0; } -#define WinObj_repr NULL +static PyObject * WinObj_repr(self) + WindowObject *self; +{ + char buf[100]; + sprintf(buf, "<Window object at 0x%08.8x for 0x%08.8x>", self, self->ob_itself); + return PyString_FromString(buf); +} static int WinObj_hash(self) WindowObject *self; diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py index 6b67db1..6054e26 100644 --- a/Mac/Modules/win/winsupport.py +++ b/Mac/Modules/win/winsupport.py @@ -156,6 +156,18 @@ class MyObjectDefinition(GlobalObjectDefinition): Output("return (int)self->ob_itself;") OutRbrace() + def outputRepr(self): + Output() + Output("static PyObject * %s_repr(self)", self.prefix) + IndentLevel() + Output("%s *self;", self.objecttype) + DedentLevel() + OutLbrace() + Output("char buf[100];") + Output("""sprintf(buf, "<Window object at 0x%%08.8x for 0x%%08.8x>", self, self->ob_itself);""") + Output("return PyString_FromString(buf);") + OutRbrace() + ## def outputFreeIt(self, itselfname): ## Output("DisposeWindow(%s);", itselfname) # From here on it's basically all boiler plate... |