Original file line numberDiff line numberDiff line change@@ -1634,7 +1634,7 @@ codegen_class_body(compiler *c, stmt_ty s, int firstlineno)
16341634ADDOP_N_IN_SCOPE(c, loc, STORE_DEREF, &_Py_ID(__classdict__), cellvars);
16351635 }
16361636if (SYMTABLE_ENTRY(c)->ste_has_conditional_annotations) {
1637-ADDOP_I(c, loc, BUILD_SET, 0);
1637+ADDOP_I_IN_SCOPE(c, loc, BUILD_SET, 0);
16381638ADDOP_N_IN_SCOPE(c, loc, STORE_DEREF, &_Py_ID(__conditional_annotations__), cellvars);
16391639 }
16401640/* compile the body proper */
Original file line numberDiff line numberDiff line change@@ -1735,7 +1735,9 @@ _PyCompile_CodeGen(PyObject *ast, PyObject *filename, PyCompilerFlags *pflags,
17351735finally:
17361736Py_XDECREF(consts_list);
17371737Py_XDECREF(metadata);
1738-_PyCompile_ExitScope(c);
1738+if (c->u!=NULL) {
1739+_PyCompile_ExitScope(c);
1740+ }
17391741compiler_free(c);
17401742_PyArena_Free(arena);
17411743returnres;