From 3f49e4d06442a53510af6006145f9fe6d2ed921e Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Sun, 11 Feb 2001 01:12:53 +0000 Subject: Oops, repr didn't allocate the memory it used... --- Mac/Modules/win/Winmodule.c | 8 +++++++- Mac/Modules/win/winsupport.py | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) 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, "", 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, "", 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... -- cgit v0.12