Avoid reinitializing the types twice.

This commit is contained in:
Martin v. Löwis 2006-02-27 00:09:50 +00:00
parent 8d0701daf1
commit d3a5f53a27
2 changed files with 2 additions and 0 deletions

View File

@ -446,6 +446,7 @@ static PyObject* ast2obj_bool(bool b)
self.emit("static int init_types(void)",0) self.emit("static int init_types(void)",0)
self.emit("{", 0) self.emit("{", 0)
self.emit("if (initialized) return 1;", 1) self.emit("if (initialized) return 1;", 1)
self.emit("initialized = 1;", 1)
for dfn in mod.dfns: for dfn in mod.dfns:
self.visit(dfn) self.visit(dfn)
self.emit("return 1;", 0); self.emit("return 1;", 0);

View File

@ -392,6 +392,7 @@ static int initialized;
static int init_types(void) static int init_types(void)
{ {
if (initialized) return 1; if (initialized) return 1;
initialized = 1;
mod_type = make_type("mod", &PyBaseObject_Type, NULL, 0); mod_type = make_type("mod", &PyBaseObject_Type, NULL, 0);
Module_type = make_type("Module", mod_type, Module_fields, 1); Module_type = make_type("Module", mod_type, Module_fields, 1);
Interactive_type = make_type("Interactive", mod_type, Interactive_type = make_type("Interactive", mod_type,