diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2002-11-28 23:23:14 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2002-11-28 23:23:14 (GMT) |
commit | 27a445023925a3abb14e08acbfcdd9134ca1a275 (patch) | |
tree | 6acdc0a1054279fa35064c09e0c3ffb43c661084 /Tools | |
parent | ad692ccde15fbf55ba60457592fbdf3073cf3c0b (diff) | |
download | cpython-27a445023925a3abb14e08acbfcdd9134ca1a275.zip cpython-27a445023925a3abb14e08acbfcdd9134ca1a275.tar.gz cpython-27a445023925a3abb14e08acbfcdd9134ca1a275.tar.bz2 |
Fixed two silly bugs in the PEP252 support code, added an assert
that basechain isn't set, and made the output a bit prettier.
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/bgen/bgen/bgenObjectDefinition.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Tools/bgen/bgen/bgenObjectDefinition.py b/Tools/bgen/bgen/bgenObjectDefinition.py index d50490a..308d683 100644 --- a/Tools/bgen/bgen/bgenObjectDefinition.py +++ b/Tools/bgen/bgen/bgenObjectDefinition.py @@ -215,6 +215,7 @@ class PEP252Mixin: assert self.outputSetattr.im_func == PEP252Mixin.outputSetattr.im_func assert self.outputGetattrBody == None assert self.outputGetattrHook == None + assert self.basechain == "NULL" def outputGetattr(self): pass @@ -293,24 +294,28 @@ class PEP252Mixin: self.outputGetter(name, get) else: Output("#define %s_get_%s NULL", self.prefix, name) + Output() if set: self.outputSetter(name, set) else: Output("#define %s_set_%s NULL", self.prefix, name) + Output() Output("static PyGetSetDef %s_getsetlist[] = {", self.prefix) IndentLevel() for name, get, set, doc in self.getsetlist: if doc: - doc = `doc` + doc = '"' + doc + '"' else: doc = "NULL" - Output("{\"%s\", (getter)%s_get_%s, (setter)%s_set_%s, %s}", + Output("{\"%s\", (getter)%s_get_%s, (setter)%s_set_%s, %s},", name, self.prefix, name, self.prefix, name, doc) + Output("{NULL, NULL, NULL, NULL},") DedentLevel() Output("};") else: Output("#define %s_getsetlist NULL", self.prefix) + Output() def outputGetter(self, name, code): Output("static PyObject *%s_get_%s(%s *self, void *closure)", @@ -318,14 +323,16 @@ class PEP252Mixin: OutLbrace() Output(code) OutRbrace() + Output() def outputSetter(self, name, code): - Output("static int %s_get_%s(%s *self, PyObject *v, void *closure)", + Output("static int %s_set_%s(%s *self, PyObject *v, void *closure)", self.prefix, name, self.objecttype) OutLbrace() Output(code) Output("return 0;") OutRbrace() + Output() class GlobalObjectDefinition(ObjectDefinition): """Like ObjectDefinition but exports some parts. |