diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-02-28 22:47:29 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-02-28 22:47:29 (GMT) |
commit | 53d960c01029ca5d435d625ea8370e5a53a84a3b (patch) | |
tree | 06bfd596c5234527b899da072b298d925f7277fe /Parser/asdl_c.py | |
parent | 8ae1295c5b6cfef0fc6db5c97fe68a0b40de8331 (diff) | |
download | cpython-53d960c01029ca5d435d625ea8370e5a53a84a3b.zip cpython-53d960c01029ca5d435d625ea8370e5a53a84a3b.tar.gz cpython-53d960c01029ca5d435d625ea8370e5a53a84a3b.tar.bz2 |
Don't pollute namespace as bad as before. All the types are static now.
Diffstat (limited to 'Parser/asdl_c.py')
-rwxr-xr-x | Parser/asdl_c.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index ff091dd..3e2acf4 100755 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -347,18 +347,18 @@ class MarshalPrototypeVisitor(PickleVisitor): class PyTypesDeclareVisitor(PickleVisitor): def visitProduct(self, prod, name): - self.emit("PyTypeObject *%s_type;" % name, 0) + self.emit("static PyTypeObject *%s_type;" % name, 0) self.emit("static PyObject* ast2obj_%s(void*);" % name, 0) if prod.fields: - self.emit("char *%s_fields[]={" % name,0) + self.emit("static char *%s_fields[]={" % name,0) for f in prod.fields: self.emit('"%s",' % f.name, 1) self.emit("};", 0) def visitSum(self, sum, name): - self.emit("PyTypeObject *%s_type;" % name, 0) + self.emit("static PyTypeObject *%s_type;" % name, 0) if sum.attributes: - self.emit("char *%s_attributes[] = {" % name, 0) + self.emit("static char *%s_attributes[] = {" % name, 0) for a in sum.attributes: self.emit('"%s",' % a.name, 1) self.emit("};", 0) @@ -375,9 +375,9 @@ class PyTypesDeclareVisitor(PickleVisitor): self.visitConstructor(t, name) def visitConstructor(self, cons, name): - self.emit("PyTypeObject *%s_type;" % cons.name, 0) + self.emit("static PyTypeObject *%s_type;" % cons.name, 0) if cons.fields: - self.emit("char *%s_fields[]={" % cons.name, 0) + self.emit("static char *%s_fields[]={" % cons.name, 0) for t in cons.fields: self.emit('"%s",' % t.name, 1) self.emit("};",0) @@ -736,7 +736,7 @@ def main(srcfile): print >> f, '#include "Python.h"' print >> f, '#include "%s-ast.h"' % mod.name print >> f - print >>f, "PyTypeObject* AST_type;" + print >>f, "static PyTypeObject* AST_type;" v = ChainOfVisitors( PyTypesDeclareVisitor(f), PyTypesVisitor(f), |