From 9a1f1236ccf9fd525675b8b8ea34178851f968cc Mon Sep 17 00:00:00 2001 From: Kenny <3454741+WarriorOfWire@users.noreply.github.com> Date: Tue, 21 Jul 2020 22:43:15 -0700 Subject: require async for and async with to actually be in an async def method instead of just a generator --- py/compile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'py') diff --git a/py/compile.c b/py/compile.c index 9b0d29998..fade4c01a 100644 --- a/py/compile.c +++ b/py/compile.c @@ -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; } @@ -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); } -- cgit v1.2.3 From 2bdd62220e1a6b5072d59cbab53730f852670df9 Mon Sep 17 00:00:00 2001 From: Jerry Needell Date: Mon, 27 Jul 2020 21:50:36 -0400 Subject: adjust stack for SAMD21 to accomodate larger pystack -- update frozen module adafruit_busdevice --- frozen/Adafruit_CircuitPython_BusDevice | 2 +- ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h | 2 +- ports/atmel-samd/mpconfigport.h | 2 +- py/circuitpy_mpconfig.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'py') diff --git a/frozen/Adafruit_CircuitPython_BusDevice b/frozen/Adafruit_CircuitPython_BusDevice index e9411c424..eb4b21e21 160000 --- a/frozen/Adafruit_CircuitPython_BusDevice +++ b/frozen/Adafruit_CircuitPython_BusDevice @@ -1 +1 @@ -Subproject commit e9411c4244984b69ec6928370ede40cec014c10b +Subproject commit eb4b21e216efd8ec0c4862a938e81b56be961724 diff --git a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h index 0c5e5b762..12c48b1e3 100644 --- a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h @@ -28,7 +28,7 @@ #define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up" // Increase stack size slightly due to CPX library import nesting -#define CIRCUITPY_DEFAULT_STACK_SIZE (4760) //divisible by 8 +#define CIRCUITPY_DEFAULT_STACK_SIZE (4248) //divisible by 8 #define USER_NEOPIXELS_PIN (&pin_PB23) diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index 540a2f77c..2a2428d67 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -109,7 +109,7 @@ #endif #ifndef CIRCUITPY_DEFAULT_STACK_SIZE -#define CIRCUITPY_DEFAULT_STACK_SIZE 4096 +#define CIRCUITPY_DEFAULT_STACK_SIZE 3584 #endif #ifndef SAMD21_BOD33_LEVEL diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index a1a7ec238..255ab99b9 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -799,7 +799,7 @@ void supervisor_run_background_tasks_if_tick(void); #endif #ifndef CIRCUITPY_PYSTACK_SIZE -#define CIRCUITPY_PYSTACK_SIZE 1024 +#define CIRCUITPY_PYSTACK_SIZE 1536 #endif #define CIRCUITPY_BOOT_OUTPUT_FILE "/boot_out.txt" -- cgit v1.2.3