_PyCompile_CodeUnitMetadata *_PyCompile_Metadata(struct _PyCompiler *c);
PyObject *_PyCompile_StaticAttributesAsTuple(struct _PyCompiler *c);
-#ifndef NDEBUG
-int _PyCompile_IsTopLevelAwait(struct _PyCompiler *c);
-#endif
-
struct symtable *_PyCompile_Symtable(struct _PyCompiler *c);
PySTEntryObject *_PyCompile_SymtableEntry(struct _PyCompiler *c);
struct _PyCompiler;
typedef struct _PyCompiler compiler;
-#define IS_TOP_LEVEL_AWAIT(C) _PyCompile_IsTopLevelAwait(C)
#define INSTR_SEQUENCE(C) _PyCompile_InstrSequence(C)
#define FUTURE_FEATURES(C) _PyCompile_FutureFeatures(C)
#define SYMTABLE(C) _PyCompile_Symtable(C)
PyCodeObject *co = NULL;
_PyCompile_InlinedComprehensionState inline_state = {NULL, NULL, NULL, NO_LABEL};
comprehension_ty outermost;
-#ifndef NDEBUG
- int scope_type = SCOPE_TYPE(c);
- int is_top_level_await = IS_TOP_LEVEL_AWAIT(c);
-#endif
PySTEntryObject *entry = _PySymtable_Lookup(SYMTABLE(c), (void *)e);
if (entry == NULL) {
goto error;
}
Py_CLEAR(entry);
- assert (!is_async_comprehension ||
- type == COMP_GENEXP ||
- scope_type == COMPILE_SCOPE_ASYNC_FUNCTION ||
- scope_type == COMPILE_SCOPE_COMPREHENSION ||
- is_top_level_await);
-
if (type != COMP_GENEXP) {
int op;
switch (type) {
ADD_YIELD_FROM(c, loc, 0);
break;
case Await_kind:
- assert(IS_TOP_LEVEL_AWAIT(c) || (_PyST_IsFunctionLike(SYMTABLE_ENTRY(c)) && (
- SCOPE_TYPE(c) == COMPILE_SCOPE_ASYNC_FUNCTION ||
- SCOPE_TYPE(c) == COMPILE_SCOPE_COMPREHENSION
- )));
-
VISIT(c, expr, e->v.Await.value);
ADDOP_I(c, loc, GET_AWAITABLE, 0);
ADDOP_LOAD_CONST(c, loc, Py_None);
return &c->u->u_metadata;
}
-#ifndef NDEBUG
-int
-_PyCompile_IsTopLevelAwait(compiler *c)
-{
- return c->c_flags.cf_flags & PyCF_ALLOW_TOP_LEVEL_AWAIT &&
- c->u->u_ste->ste_type == ModuleBlock;
-}
-#endif
-
// Merge *obj* with constant cache, without recursion.
int
_PyCompile_ConstCacheMergeOne(PyObject *const_cache, PyObject **obj)