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

Skip to content

Commit 09eef17

Browse files
committed
Enable optional "const" argument to _New routines.
1 parent 7bcabc6 commit 09eef17

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Tools/bgen/bgen/bgenObjectDefinition.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class ObjectDefinition(GeneratorGroup):
77
tp_flags = "Py_TPFLAGS_DEFAULT"
88
basetype = None
99
argref = "" # set to "*" if arg to <type>_New should be pointer
10+
argconst = "" # set to "const " if arg to <type>_New should be const
1011

1112
def __init__(self, name, prefix, itselftype):
1213
"""ObjectDefinition constructor. May be extended, but do not override.
@@ -97,8 +98,8 @@ def outputStructMembers(self):
9798

9899
def outputNew(self):
99100
Output()
100-
Output("%sPyObject *%s_New(%s %sitself)", self.static, self.prefix,
101-
self.itselftype, self.argref)
101+
Output("%sPyObject *%s_New(%s%s %sitself)", self.static, self.prefix,
102+
self.argconst, self.itselftype, self.argref)
102103
OutLbrace()
103104
Output("%s *it;", self.objecttype)
104105
self.outputCheckNewArg()

0 commit comments

Comments
 (0)