diff --git a/Tools/bgen/bgen/bgenGenerator.py b/Tools/bgen/bgen/bgenGenerator.py index bf81096fbab..94905be22d3 100644 --- a/Tools/bgen/bgen/bgenGenerator.py +++ b/Tools/bgen/bgen/bgenGenerator.py @@ -37,12 +37,8 @@ class BaseFunctionGenerator: def functionheader(self): Output() - Output("static PyObject *%s_%s(_self, _args)", - self.prefix, self.name) - IndentLevel() - Output("%s *_self;", self.objecttype) - Output("PyObject *_args;") - DedentLevel() + Output("static PyObject *%s_%s(%s *_self, PyObject *_args)", + self.prefix, self.name, self.objecttype) OutLbrace() Output("PyObject *_res = NULL;") diff --git a/Tools/bgen/bgen/bgenModule.py b/Tools/bgen/bgen/bgenModule.py index b1d5d14123b..b4a3db05edc 100644 --- a/Tools/bgen/bgen/bgenModule.py +++ b/Tools/bgen/bgen/bgenModule.py @@ -38,7 +38,7 @@ class Module(GeneratorGroup): Output("%s", self.finalstuff) Output() - Output("void init%s()", self.name) + Output("void init%s(void)", self.name) OutLbrace() Output("PyObject *m;") Output("PyObject *d;") diff --git a/Tools/bgen/bgen/bgenObjectDefinition.py b/Tools/bgen/bgen/bgenObjectDefinition.py index f3d120c3c50..b6f33fe7470 100644 --- a/Tools/bgen/bgen/bgenObjectDefinition.py +++ b/Tools/bgen/bgen/bgenObjectDefinition.py @@ -80,10 +80,8 @@ class ObjectDefinition(GeneratorGroup): def outputNew(self): Output() - Output("%sPyObject *%s_New(itself)", self.static, self.prefix) - IndentLevel() - Output("%s %sitself;", self.itselftype, self.argref) - DedentLevel() + Output("%sPyObject *%s_New(%s %sitself)", self.static, self.prefix, + self.itselftype, self.argref) OutLbrace() Output("%s *it;", self.objecttype) self.outputCheckNewArg() @@ -100,11 +98,8 @@ class ObjectDefinition(GeneratorGroup): "Override this method to apply additional checks/conversions" def outputConvert(self): - Output("%s%s_Convert(v, p_itself)", self.static, self.prefix) - IndentLevel() - Output("PyObject *v;") - Output("%s *p_itself;", self.itselftype) - DedentLevel() + Output("%s%s_Convert(PyObject *v, %s *p_itself)", self.static, self.prefix, + self.itselftype) OutLbrace() self.outputCheckConvertArg() Output("if (!%s_Check(v))", self.prefix) @@ -121,10 +116,7 @@ class ObjectDefinition(GeneratorGroup): def outputDealloc(self): Output() - Output("static void %s_dealloc(self)", self.prefix) - IndentLevel() - Output("%s *self;", self.objecttype) - DedentLevel() + Output("static void %s_dealloc(%s *self)", self.prefix, self.objecttype) OutLbrace() self.outputCleanupStructMembers() Output("PyMem_DEL(self);") @@ -138,11 +130,7 @@ class ObjectDefinition(GeneratorGroup): def outputGetattr(self): Output() - Output("static PyObject *%s_getattr(self, name)", self.prefix) - IndentLevel() - Output("%s *self;", self.objecttype) - Output("char *name;") - DedentLevel() + Output("static PyObject *%s_getattr(%s *self, char *name)", self.prefix, self.objecttype) OutLbrace() self.outputGetattrBody() OutRbrace() @@ -226,10 +214,8 @@ class ObjectIdentityMixin: def outputCompare(self): Output() - Output("static int %s_compare(self, other)", self.prefix) - IndentLevel() - Output("%s *self, *other;", self.objecttype) - DedentLevel() + Output("static int %s_compare(%s *self, %s *other)", self.prefix, self.objecttype, + self.objecttype) OutLbrace() Output("unsigned long v, w;") Output() @@ -250,10 +236,7 @@ class ObjectIdentityMixin: def outputHash(self): Output() - Output("static long %s_hash(self)", self.prefix) - IndentLevel() - Output("%s *self;", self.objecttype) - DedentLevel() + Output("static long %s_hash(%s *self)", self.prefix, self.objecttype) OutLbrace() Output("return (long)self->ob_itself;") OutRbrace()