summaryrefslogtreecommitdiff
path: root/py
AgeCommit message (Collapse)Author
2017-01-27py/py.mk: Add CFLAGS_MOD flag to set config file for FatFs.Damien George
2017-01-27py/showbc: Make sure to set the const_table before printing bytecode.Damien George
2017-01-27py/objstr: Optimize string concatenation with empty string.Paul Sokolovsky
In this, don't allocate copy, just return non-empty string. This helps with a standard pattern of buffering data in case of short reads: buf = b"" while ...: s = f.read(...) buf += s ... For a typical case when single read returns all data needed, there won't be extra allocation. This optimization helps uasyncio.
2017-01-26py/objmodule: Move module init/deinit code into runtime functions.Damien George
They are one-line functions and having them inline in mp_init/mp_deinit eliminates the overhead of a function call, and matches how other state is initialised in mp_init.
2017-01-25py/objint: Fix left-shift overflow in checking for large int.Damien George
2017-01-22py/builtinhelp: Implement help('modules') to list available modules.Damien George
This is how CPython does it, and it's very useful to help users discover the available modules for a given port, especially built-in and frozen modules. The function does not list modules that are in the filesystem because this would require a fair bit of work to do correctly, and is very port specific (depending on the filesystem).
2017-01-22py: Move weak-link map to objmodule.c, and expose module maps as public.Damien George
2017-01-22py: Add builtin help function to core, with default help msg.Damien George
This builtin is configured using MICROPY_PY_BUILTINS_HELP, and is disabled by default.
2017-01-21py/objint_longlong: Add stub for mp_obj_int_from_bytes_impl().Paul Sokolovsky
To be implemented later.
2017-01-21py/objint: from_bytes(): Implement "byteorder" param and arbitrary precision.Paul Sokolovsky
If result guaranteedly fits in a small int, it is handled in objint.c. Otherwise, it is delegated to mp_obj_int_from_bytes_impl(), which should be implemented by individual objint_*.c, similar to mp_obj_int_to_bytes_impl().
2017-01-21py/mpz: Implement mpz_set_from_bytes() as a foundation for int.from_bytes().Paul Sokolovsky
2017-01-19py/objint_mpz: Refactor switch-statement to remove unreachable default.Damien George
2017-01-19py/formatfloat: Remove unreachable code.Damien George
The if-block that this unreachable code is in has a condition "f>=5" so "fp_isless1(f)" will always fail.
2017-01-17py/binary: mp_binary_get_size: Raise error on unsupported typecodes.Paul Sokolovsky
Previouly, we had errors checked in callers, which led to duplicate code or missing checks in some places.
2017-01-17py/runtime: Refactor default case of switch to remove assert(0).Damien George
2017-01-17py/objexcept: Replace if-cond and assert(0) with simple assert.Damien George
2017-01-17py/emitnative: Remove assert(0)'s or replace with mp_not_implemented.Damien George
2017-01-17py/parse: Refactor code to remove assert(0)'s.Damien George
This helps to improve code coverage. Note that most of the changes in this patch are just de-denting the cases of the switch statements.
2017-01-17py/objgenerator: Don't raise RuntimeError if GeneratorExit ignored.Damien George
In this case it's allowed to be ignored.
2017-01-17py/objgenerator: When throwing an object, don't make an exc instance.Damien George
Arguments to throw() for generators don't need to be exceptions.
2017-01-17py/runtime: Fix handling of throw() when resuming generator.Damien George
If GeneratorExit is injected as a throw-value then that should lead to the close() method being called, if it exists. If close() does not exist then throw() should not be called, and this patch fixes this.
2017-01-17py/runtime: Refactor assert(0) to improve coverage.Damien George
2017-01-16py/builtinimport: Remove unreachable code and change obj-import comment.Damien George
2017-01-16py/builtinimport: Raise ValueError for bad relative import, per CPython.Damien George
2017-01-08py/builtinimport: Fix bug when importing names from frozen packages.Damien George
The commit d9047d3c8a99603884db25076c37778f50633ca6 introduced a bug whereby "from a.b import c" stopped working for frozen packages. This is because the path was not properly truncated and became "a//b". Such a path resolves correctly for a "real" filesystem, but not for a search in the list of frozen modules.
2017-01-05py/mkrules.mk: Add MPY_CROSS_FLAGS option to pass flags to mpy-cross.Damien George
So that ports can pass their own custom options to mpy-cross.
2017-01-03py/asmarm: Fix assembler's PASS_EMIT constant name.Damien George
2016-12-28py/unicode: Comment-out unused function unichar_isprint.Damien George
2016-12-28py/objint: Simplify mp_int_format_size and remove unreachable code.Damien George
One never needs to format integers with a base larger than 16 (but code can be easily extended beyond this value if needed in the future).
2016-12-28py/mpprint: Add assertion for, and comment about, valid base values.Damien George
2016-12-28py/parsenum: Fix warning for signed/unsigned comparison.Damien George
2016-12-28py/mpz: Fix assertion in mpz_set_from_str which checks value of base.Damien George
2016-12-28py/parsenum: Simplify and generalise decoding of digit values.Damien George
This function should be able to parse integers with any value for the base, because it is called by int('xxx', base).
2016-12-27cc3200: Re-add support for UART REPL (MICROPY_STDIO_UART setting).Paul Sokolovsky
UART REPL support was lost in os.dupterm() refactorings, etc. As os.dupterm() is there, implement UART REPL support at the high level - if MICROPY_STDIO_UART is set, make default boot.py contain os.dupterm() call for a UART. This means that changing MICROPY_STDIO_UART value will also require erasing flash on a module to force boot.py re-creation.
2016-12-27py/misc.h: Typo fix in comment.Paul Sokolovsky
2016-12-22py/lexer: Permanently disable the mp_lexer_show_token function.Damien George
The lexer is very mature and this debug function is no longer used. If it's really needed one can uncomment it and recompile.
2016-12-22py/lexer: Remove unnecessary check for EOF in lexer's next_char func.Damien George
This check always fails (ie chr0 is never EOF) because the callers of this function never call it past the end of the input stream. And even if they did it would be harmless because 1) reader.readbyte must continue to return an EOF char if the stream is exhausted; 2) next_char would just count the subsequent EOF's as characters worth 1 column.
2016-12-22py/lexer: Remove unreachable code in string tokeniser.Damien George
2016-12-22tests/basics/lexer: Add a test for newline-escaping within a string.Damien George
2016-12-22extmod/modutimeq: Refactor into optimized class.Paul Sokolovsky
import utimeq, utime # Max queue size, the queue allocated statically on creation q = utimeq.utimeq(10) q.push(utime.ticks_ms(), data1, data2) res = [0, 0, 0] # Items in res are filled up with results q.pop(res)
2016-12-21py/emitglue: Refactor to remove assert(0), to improve coverage.Damien George
2016-12-21py/objint: Rename mp_obj_int_as_float to mp_obj_int_as_float_impl.Damien George
And also simplify it to remove the check for small int. This can be done because this function is only ever called if the argument is not a small int.
2016-12-20py/modbuiltins: Remove unreachable code.Damien George
2016-12-19py/compile: Add an extra pass for Xtensa inline assembler.Damien George
It needs an extra pass to compute the size of the constant table for the l32r instructions.
2016-12-15py: Add MICROPY_KBD_EXCEPTION config option to provide mp_kbd_exception.Damien George
Defining and initialising mp_kbd_exception is boiler-plate code and so the core runtime can provide it, instead of each port needing to do it themselves. The exception object is placed in the VM state rather than on the heap.
2016-12-14py/mpconfig.h: Enable MICROPY_PY_SYS_EXIT by default.Paul Sokolovsky
sys.exit() is an important function to terminate a program. In particular, the testsuite relies on it to skip tests (i.e. any other functionality may be disabled, but sys.exit() is required to at least report that properly).
2016-12-14py/runtime: Zero out fs_user_mount array in mp_init.Damien George
There's no need to force ports to copy-and-paste this initialisation code. If FSUSERMOUNT is enabled then this zeroing out must be done.
2016-12-14py/mpz: Remove unreachable code in mpn_or_neg functions.Damien George
2016-12-13py/builtinimport: Support importing packages from compiled .mpy files.Damien George
This patch ensures that __init__.mpy files are imported if their containing directory is imported as a package.
2016-12-12py/binary: Do zero extension when storing a value larger than word size.Damien George