Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7b8f0a1

Browse files
committed
Sigh, changed the argument names in the tp_init function: to make them be
more in line with other methods "self" and "args" had to be renamed "_self" and "_args". Did "_kwds" too, for consistency.
1 parent f73b4b0 commit 7b8f0a1

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

Tools/bgen/bgen/bgenObjectDefinition.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def outputHook_tp_free(self):
385385

386386
def output_tp_init(self):
387387
if self.output_tp_initBody:
388-
Output("static int %s_tp_init(PyObject *self, PyObject *args, PyObject *kwds)", self.prefix)
388+
Output("static int %s_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)", self.prefix)
389389
OutLbrace()
390390
self.output_tp_initBody()
391391
OutRbrace()
@@ -407,19 +407,19 @@ def output_tp_alloc(self):
407407
Output()
408408

409409
def output_tp_newBody(self):
410-
Output("PyObject *self;");
410+
Output("PyObject *_self;");
411411
Output("%s itself;", self.itselftype);
412412
Output("char *kw[] = {\"itself\", 0};")
413413
Output()
414-
Output("if (!PyArg_ParseTupleAndKeywords(args, kwds, \"O&\", kw, %s_Convert, &itself)) return NULL;",
414+
Output("if (!PyArg_ParseTupleAndKeywords(_args, _kwds, \"O&\", kw, %s_Convert, &itself)) return NULL;",
415415
self.prefix);
416-
Output("if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;")
417-
Output("((%s *)self)->ob_itself = itself;", self.objecttype)
418-
Output("return self;")
416+
Output("if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;")
417+
Output("((%s *)_self)->ob_itself = itself;", self.objecttype)
418+
Output("return _self;")
419419

420420
def output_tp_new(self):
421421
if self.output_tp_newBody:
422-
Output("static PyObject *%s_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)", self.prefix)
422+
Output("static PyObject *%s_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)", self.prefix)
423423
OutLbrace()
424424
self.output_tp_newBody()
425425
OutRbrace()

0 commit comments

Comments
 (0)