aboutsummaryrefslogtreecommitdiff
path: root/lib/utils/pyexec.c
AgeCommit message (Collapse)Author
2020-02-28all: Reformat C and Python source code with tools/codeformat.py.Damien George
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-07lib/utils/pyexec: Handle pending exceptions after disabling kbd intrs.Damien George
Pending exceptions would otherwise be handled later on where there may not be an NLR handler in place. A similar fix is also made to the unix port's REPL handler. Fixes issues #4921 and #5488.
2019-12-28lib/utils/pyexec: Introduce MICROPY_REPL_INFO, wrap debug prints in it.Yonatan Goldschmidt
For the 3 ports that already make use of this feature (stm32, nrf and teensy) this doesn't make any difference, it just allows to disable it from now on. For other ports that use pyexec, this decreases code size because the debug printing code is dead (it can't be enabled) but the compiler can't deduce that, so code is still emitted.
2019-08-28py: Add global default_emit_opt variable to make emit kind persistent.Damien George
mp_compile no longer takes an emit_opt argument, rather this setting is now provided by the global default_emit_opt variable. Now, when -X emit=native is passed as a command-line option, the emitter will be set for all compiled modules (included imports), not just the top-level script. In the future there could be a way to also set this variable from a script. Fixes issue #4267.
2019-05-01lib/utils: Make pyexec_file_if_exists run frozen scripts if they exist.Andrew Leech
So that boot.py and/or main.py can be frozen (either as STR or MPY) in the same way that other scripts are frozen. Frozen scripts have preference to scripts in the VFS.
2019-04-26lib/utils/pyexec: Add pyexec_file_if_exists() helper function.Damien George
It will only execute the script if it can be stat'd and is a file.
2019-02-12all: Change PYB message prefix to MPY.Mike Causer
Replaces "PYB: soft reboot" with "MPY: soft reboot", etc. Having a consistent prefix across ports reduces the difference between ports, which is a general goal. And this change won't break pyboard.py because that tool only looks for "soft reboot".
2019-01-28lib/utils/pyexec: Implement paste mode with event driven REPL.Damien George
2018-10-13lib/utils/pyexec: Forcefully unlock the heap if locked and REPL active.Damien George
Otherwise there is really nothing that can be done, it can't be unlocked by the user because there is no way to allocate memory to execute the unlock. See issue #4205 and #4209.
2018-07-08lib/utils: Fix to support compiling with object representation D.Damien George
2018-02-13lib/utils/pyexec: Update to work with new MICROPY_HW_ENABLE_USB option.Damien George
2017-10-04all: Remove inclusion of internal py header files.Damien George
Header files that are considered internal to the py core and should not normally be included directly are: py/nlr.h - internal nlr configuration and declarations py/bc0.h - contains bytecode macro definitions py/runtime0.h - contains basic runtime enums Instead, the top-level header files to include are one of: py/obj.h - includes runtime0.h and defines everything to use the mp_obj_t type py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h, and defines everything to use the general runtime support functions Additional, specific headers (eg py/objlist.h) can be included if needed.
2017-07-31all: Use the name MicroPython consistently in commentsAlexander Steffen
There were several different spellings of MicroPython present in comments, when there should be only one.
2017-05-05lib/utils/pyexec: Update event-driven REPL to match non-event REPL.Tom Collins
Don't print dupe ">>> " prompt when starting event-driven REPL. Clear incomplete line in transition from raw to friendly REPL.
2017-03-14lib/utils/pyexec: Fix bug with pyexec_file not setting flag for source.Damien George
2017-03-14lib/utils/pyexec: Refactor to put lexer constructors all in one place.Damien George
The lexer can now raise an exception on construction so it must go within an nlr handler block.
2017-02-27lib/utils/pyexec: Allow to compile when the uPy compiler is disabled.Damien George
2017-01-22lib/utils/pyexec: Only print help prompt if HELP feature is enabled.Damien George
2016-10-26zephyr: Fix mp_hal_set_interrupt_char() declaration to be compatible.Paul Sokolovsky
With other ports. Other ports declare it in mphalport.h, it can be inline or macro.
2016-10-26lib/utils/pyexec: Fix compilation warning of type vs format mismatch.Paul Sokolovsky
This happens with some compilers on some architectures, which don't define size_t as unsigned int. MicroPython's printf() dooesn't support obscure format specifiers for size_t, so the obvious choice is to explicitly cast to unsigned, to match %u used in printf().
2016-10-26lib/utils/pyexec: Add mp_hal_set_interrupt_char() prototype.Vincenzo Frascino
This patch removes a compilation warning in pyexec. Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-10-17lib/utils/pyexec: Allow behaviour of SystemExit to be configurable.Damien George
Setting the pyexec_system_exit variable to PYEXEC_FORCED_EXT allows SystemExit exceptions to terminate the pyexec functions.
2016-10-14py/vstr: Combine vstr_new_size with vstr_new since they are rarely used.Damien George
Now there is just one function to allocate a new vstr, namely vstr_new (in addition to vstr_init etc). The caller of this function should know what initial size to allocate for the buffer, or at least have some policy or config option, instead of leaving it to a default (as it was before).
2016-10-12lib/utils/pyexec: Don't treat SystemExit as "forced exit".Paul Sokolovsky
"Forced exit" is treated as soft-reboot (Ctrl+D). But expected effect of calling sys.exit() is termination of the current script, not any further and more serious actions like mentioned soft reboot.
2016-08-30lib/utils/pyexec: qstr_pool_info() requires size_t* parameters.Paul Sokolovsky
2016-07-21lib/utils/pyexec: Use full path to readline.h header, per latest conventions.Paul Sokolovsky
2016-04-19lib/utils/pyexec: Condition-out GC calls from pyexec.Colin Hogben
A port which uses lib/utils/pyexec.c but which does not enable garbage collection should not need to implement the gc_collect function. This patch also moves the gc_collect call to after printing the qstr info. Since qstrs cannot be collected it should not make any difference to the printed statistics.
2016-04-13py: Add ability to have frozen persistent bytecode from .mpy files.Damien George
The config variable MICROPY_MODULE_FROZEN is now made of two separate parts: MICROPY_MODULE_FROZEN_STR and MICROPY_MODULE_FROZEN_MPY. This allows to have none, either or both of frozen strings and frozen mpy files (aka frozen bytecode).
2016-04-01esp8266: Disallow recursive calls to REPL.Paul Sokolovsky
Before this change, if REPL blocked executing some code, it was possible to still input new statememts and excuting them, all leading to weird, and portentially dangerous interaction. TODO: Current implementation may have issues processing input accumulated while REPL was blocked.
2016-03-30esp8266: Fix issue when current repl line was garbage-collected.Paul Sokolovsky
Reference it from root pointers section.
2015-12-26lib/utils: Add pyexec_frozen_module to load and execute frozen module.Damien George
This is a convenience function similar to pyexec_file. It should be used instead of raw mp_parse_compile_execute because the latter does not catch and report exceptions.
2015-11-09lib/pyexec: Move header pyexec.h from stmhal directory.Damien George
2015-11-03lib/pyexec: For paste mode use "Ctrl" as the name of the key, not "CTRL".Damien George
2015-10-31stmhal: pyexec.c is common module, move to lib/utils/ .Paul Sokolovsky