Skip to content

Commit

Permalink
- tp_init shouldn't call base class tp_init by default
Browse files Browse the repository at this point in the history
- tp_new (which was apparently always overridden:-) called base class
  tp_init in stead of tp_new.
  • Loading branch information
jackjansen committed Apr 20, 2006
1 parent 3b675d2 commit f75225b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Tools/bgen/bgen/bgenObjectDefinition.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ def outputHook_tp_free(self):
Output("%s_tp_free, /* tp_free */", self.prefix)

def output_tp_initBody_basecall(self):
"""If a type shares its init call with its base type set output_tp_initBody
to output_tp_initBody_basecall"""
if self.basetype:
Output("if (%s.tp_init)", self.basetype)
OutLbrace()
Expand All @@ -395,7 +397,6 @@ def output_tp_init(self):
if self.output_tp_initBody:
Output("static int %s_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)", self.prefix)
OutLbrace()
self.output_tp_initBody_basecall()
self.output_tp_initBody()
OutRbrace()
else:
Expand Down Expand Up @@ -425,7 +426,7 @@ def output_tp_newBody(self):
if self.basetype:
Output("if (%s.tp_new)", self.basetype)
OutLbrace()
Output("if ( (*%s.tp_init)(_self, _args, _kwds) == NULL) return NULL;", self.basetype)
Output("if ( (*%s.tp_new)(type, _args, _kwds) == NULL) return NULL;", self.basetype)
Dedent()
Output("} else {")
Indent()
Expand Down

0 comments on commit f75225b

Please sign in to comment.