Skip to content

Commit 6c856bc

Browse files
Fix crash in compiler_mod() when entering the current compilation unit fails
1 parent 9fdbade commit 6c856bc

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Python/compile.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,9 @@ compiler_mod(compiler *c, mod_ty mod)
898898
}
899899
co = _PyCompile_OptimizeAndAssemble(c, addNone);
900900
finally:
901-
_PyCompile_ExitScope(c);
901+
if (c->u != NULL) {
902+
_PyCompile_ExitScope(c);
903+
}
902904
return co;
903905
}
904906

0 commit comments

Comments
 (0)