Kaydet (Commit) 09eef173 authored tarafından Jack Jansen's avatar Jack Jansen

Enable optional "const" argument to _New routines.

üst 7bcabc60
...@@ -7,6 +7,7 @@ class ObjectDefinition(GeneratorGroup): ...@@ -7,6 +7,7 @@ class ObjectDefinition(GeneratorGroup):
tp_flags = "Py_TPFLAGS_DEFAULT" tp_flags = "Py_TPFLAGS_DEFAULT"
basetype = None basetype = None
argref = "" # set to "*" if arg to <type>_New should be pointer argref = "" # set to "*" if arg to <type>_New should be pointer
argconst = "" # set to "const " if arg to <type>_New should be const
def __init__(self, name, prefix, itselftype): def __init__(self, name, prefix, itselftype):
"""ObjectDefinition constructor. May be extended, but do not override. """ObjectDefinition constructor. May be extended, but do not override.
...@@ -97,8 +98,8 @@ class ObjectDefinition(GeneratorGroup): ...@@ -97,8 +98,8 @@ class ObjectDefinition(GeneratorGroup):
def outputNew(self): def outputNew(self):
Output() Output()
Output("%sPyObject *%s_New(%s %sitself)", self.static, self.prefix, Output("%sPyObject *%s_New(%s%s %sitself)", self.static, self.prefix,
self.itselftype, self.argref) self.argconst, self.itselftype, self.argref)
OutLbrace() OutLbrace()
Output("%s *it;", self.objecttype) Output("%s *it;", self.objecttype)
self.outputCheckNewArg() self.outputCheckNewArg()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment