Skip to content

Commit d3a5f53

Browse files
committed
Avoid reinitializing the types twice.
1 parent 8d0701d commit d3a5f53

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

Parser/asdl_c.py

+1
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ def visitModule(self, mod):
446446
self.emit("static int init_types(void)",0)
447447
self.emit("{", 0)
448448
self.emit("if (initialized) return 1;", 1)
449+
self.emit("initialized = 1;", 1)
449450
for dfn in mod.dfns:
450451
self.visit(dfn)
451452
self.emit("return 1;", 0);

Python/Python-ast.c

+1
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ static int initialized;
392392
static int init_types(void)
393393
{
394394
if (initialized) return 1;
395+
initialized = 1;
395396
mod_type = make_type("mod", &PyBaseObject_Type, NULL, 0);
396397
Module_type = make_type("Module", mod_type, Module_fields, 1);
397398
Interactive_type = make_type("Interactive", mod_type,

0 commit comments

Comments
 (0)