diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 72ee60cc0c..299c1d5985 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -35,6 +35,20 @@ msgid "" "https://github.com/adafruit/circuitpython/issues\n" msgstr "" +#: main.c +msgid "" +"\n" +"WARNING: Allocating pystack failed, defaulting back to build value. \n" +"\n" +msgstr "" + +#: main.c +msgid "" +"\n" +"WARNING: Invalid CIRCUITPY_PYSTACK_SIZE, defaulting back to build value.\n" +"\n" +msgstr "" + #: py/obj.c msgid " File \"%q\"" msgstr "" diff --git a/main.c b/main.c index 599c80eb45..64251e88a7 100644 --- a/main.c +++ b/main.c @@ -141,12 +141,15 @@ STATIC supervisor_allocation __attribute__ ((noinline)) * alloc_pystack(void) { (void)common_hal_os_getenv_int("CIRCUITPY_PYSTACK_SIZE", &pystack_size); // Check if value is valid if ((CIRCUITPY_PYSTACK_SIZE != pystack_size) && ((pystack_size < 384) || (pystack_size % sizeof(size_t) != 0))) { + serial_write_compressed(translate("\nWARNING: Invalid CIRCUITPY_PYSTACK_SIZE, defaulting back to build value.\n\n")); pystack_size = CIRCUITPY_PYSTACK_SIZE; // Reset - // TODO: Find a way to inform the user about it. - // Perhaps safemode? Or is it too much? } #endif supervisor_allocation *pystack = allocate_memory(pystack_size, false, false); + if (pystack == NULL) { + serial_write_compressed(translate("\nWARNING: Allocating pystack failed, defaulting back to build value. \n\n")); + pystack = allocate_memory(CIRCUITPY_PYSTACK_SIZE, false, false); + } return pystack; } #endif