]> granicus.if.org Git - python/commitdiff
Enable optional "const" argument to _New routines.
authorJack Jansen <jack.jansen@cwi.nl>
Mon, 21 Nov 2005 13:24:25 +0000 (13:24 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Mon, 21 Nov 2005 13:24:25 +0000 (13:24 +0000)
Tools/bgen/bgen/bgenObjectDefinition.py

index 6fc65ad3bd70dd75ff41f3f6fc81e725442c7eab..1a44ca43c61f0e54c441ee9d7a47a6f9ac9f6248 100644 (file)
@@ -7,6 +7,7 @@ class ObjectDefinition(GeneratorGroup):
     tp_flags = "Py_TPFLAGS_DEFAULT"
     basetype = None
     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):
         """ObjectDefinition constructor.  May be extended, but do not override.
@@ -97,8 +98,8 @@ class ObjectDefinition(GeneratorGroup):
 
     def outputNew(self):
         Output()
-        Output("%sPyObject *%s_New(%s %sitself)", self.static, self.prefix,
-                self.itselftype, self.argref)
+        Output("%sPyObject *%s_New(%s%s %sitself)", self.static, self.prefix,
+                self.argconst, self.itselftype, self.argref)
         OutLbrace()
         Output("%s *it;", self.objecttype)
         self.outputCheckNewArg()