Skip to content

Require await in async #3202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-21 18:43-0700\n"
"POT-Creation-Date: 2020-07-24 19:58-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -110,10 +110,6 @@ msgstr ""
msgid "'%q' argument required"
msgstr ""

#: py/objarray.c
msgid "'%q' object is not bytes-like"
msgstr ""

#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
Expand Down Expand Up @@ -219,11 +215,11 @@ msgid "'align' requires 1 argument"
msgstr ""

#: py/compile.c
msgid "'async for' or 'async with' outside async function"
msgid "'await' outside function"
msgstr ""

#: py/compile.c
msgid "'await' outside function"
msgid "'await', 'async for' or 'async with' outside async function"
msgstr ""

#: py/compile.c
Expand Down Expand Up @@ -1336,10 +1332,6 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr ""

#: ports/stm/ref/pulseout-pre-timeralloc.c
msgid "PulseOut not supported on this chip"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being deleted? Maybe you need to merge adafruit/main into your branch?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind. This was my mistake in my PR. This was an error I added but deleted before merging. 🙄

msgstr ""

#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
Expand Down Expand Up @@ -1773,7 +1765,7 @@ msgstr ""
msgid "__new__ arg must be a user-type"
msgstr ""

#: extmod/modubinascii.c extmod/moduhashlib.c
#: extmod/modubinascii.c extmod/moduhashlib.c py/objarray.c
msgid "a bytes-like object is required"
msgstr ""

Expand Down
5 changes: 3 additions & 2 deletions py/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1713,11 +1713,11 @@ STATIC void compile_yield_from(compiler_t *comp) {
#if MICROPY_PY_ASYNC_AWAIT
STATIC bool compile_require_async_context(compiler_t *comp, mp_parse_node_struct_t *pns) {
int scope_flags = comp->scope_cur->scope_flags;
if(scope_flags & MP_SCOPE_FLAG_GENERATOR) {
if(scope_flags & MP_SCOPE_FLAG_ASYNC) {
return true;
}
compile_syntax_error(comp, (mp_parse_node_t)pns,
translate("'async for' or 'async with' outside async function"));
translate("'await', 'async for' or 'async with' outside async function"));
return false;
}

Expand Down Expand Up @@ -2645,6 +2645,7 @@ STATIC void compile_atom_expr_await(compiler_t *comp, mp_parse_node_struct_t *pn
compile_syntax_error(comp, (mp_parse_node_t)pns, translate("'await' outside function"));
return;
}
compile_require_async_context(comp, pns);
compile_atom_expr_normal(comp, pns);
compile_yield_from(comp);
}
Expand Down