aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-03-01tests/unix: Add coverage tests for various GC calls.Damien George
2018-03-01py/formatfloat: Fix case where floats could render with negative digits.Damien George
Prior to this patch, some architectures (eg unix x86) could render floats with "negative" digits, like ")". For example, '%.23e' % 1e-80 would come out as "1.0000000000000000/)/(,*0e-80". This patch fixes the known cases.
2018-03-01py/formatfloat: Fix case where floats could render with a ":" character.Damien George
Prior to this patch, some architectures (eg unix x86) could render floats with a ":" character in them, eg 1e+39 would come out as ":e+38" (":" is just after "9" in ASCII so this is like 10e+38). This patch fixes some of these cases.
2018-03-01py/formatfloat: Fix rounding of %f format with edge-case FP values.Damien George
Prior to this patch the %f formatting of some FP values could be off by up to 1, eg '%.0f' % 123 would return "122" (unix x64). Depending on the FP precision (single vs double) certain numbers would format correctly, but others wolud not. This patch should fix all cases of rounding for %f.
2018-02-28tests/extmod/vfs_fat_fileio1: Add test for calling file obj finaliser.Damien George
2018-02-28extmod/vfs_fat_diskio: Use a C-stack-allocated bytearray for block buf.Damien George
This patch eliminates heap allocation in the VFS FAT disk IO layer, when calling the underlying readblocks/writeblocks methods. The bytearray object that is passed to these methods is now allocated on the C stack rather than the heap (it's only 4 words big). This means that these methods should not retain a pointer to the buffer object that is passed in, but this was already a restriction because the original heap-allocated bytearray had its buffer passed by reference.
2018-02-27tests/basics/gc1: Add test which triggers GC threshold.Damien George
2018-02-27tests/unix: Add coverage test for VM executing invalid bytecode.Damien George
2018-02-27py/vm: Simplify handling of special-case STOP_ITERATION in yield from.Damien George
There's no need to have MP_OBJ_NULL a special case, the code can re-use the MP_OBJ_STOP_ITERATION value to signal the special case and the VM can detect this with only one check (for MP_OBJ_STOP_ITERATION).
2018-02-27py/vm: Fix case of handling raised StopIteration within yield from.Damien George
This patch concerns the handling of an NLR-raised StopIteration, raised during a call to mp_resume() which is handling the yield from opcode. Previously, commit 6738c1dded8e436686f85008ec0a4fc47406ab7a introduced code to handle this case, along with a test. It seems that it was lucky that the test worked because the code did not correctly handle the stack pointer (sp). Furthermore, commit 79d996a57b351e0ef354eb1e2f644b194433cc73 improved the way mp_resume() propagated certain exceptions: it changed raising an NLR value to returning MP_VM_RETURN_EXCEPTION. This change meant that the test introduced in gen_yield_from_ducktype.py was no longer hitting the code introduced in 6738c1dded8e436686f85008ec0a4fc47406ab7a. The patch here does two things: 1. Fixes the handling of sp in the VM for the case that yield from is interrupted by a StopIteration raised via NLR. 2. Introduces a new test to check this handling of sp and re-covers the code in the VM.
2018-02-26esp8266/modnetwork: Implement WLAN.status('rssi') for STA interface.Damien George
This will return the RSSI of the AP that the STA is connected to.
2018-02-26esp8266/uart: Allow to compile with event-driven REPL.Damien George
2018-02-26py/mpstate.h: Add repl_line state for MICROPY_REPL_EVENT_DRIVEN.Damien George
2018-02-26tests/float: Adjust float-parsing tests to pass with only a small error.Damien George
Float parsing (both single and double precision) may have a relative error of order the floating point precision, so adjust tests to take this into account by not printing all of the digits of the answer.
2018-02-26tests/extmod/uzlib_decompress: Add uzlib tests to improve coverage.Damien George
2018-02-26tests/extmod/vfs_fat_fileio1: Add test for failing alloc with finaliser.Damien George
2018-02-25tests/unix: Add coverage tests for mpz_set_from_float, mpz_mul_inpl.Damien George
These new tests cover cases that can't be reached from Python and get coverage of py/mpz.c to 100%. These "unreachable from Python" pieces of code could be removed but they form an integral part of the mpz C API and may be useful for non-Python usage of mpz.
2018-02-25py/mpz: In mpz_clone, remove unused check for NULL dig.Damien George
This path for src->deg==NULL is never used because mpz_clone() is always called with an argument that has a non-zero integer value, and hence has some digits allocated to it (mpz_clone() is a static function private to mpz.c all callers of this function first check if the integer value is zero and if so take a special-case path, bypassing the call to mpz_clone()). There is some unused and commented-out functions that may actually pass a zero-valued mpz to mpz_clone(), so some TODOs are added to these function in case they are needed in the future.
2018-02-24tests/stress: Add test to create a dict beyond "maximum" rehash size.Damien George
There is a finite list of ascending primes used for the size of a hash table, and this test tests that the code can handle a dict larger than the maximum value in that list of primes. Adding this tests gets py/map.c to 100% coverage.
2018-02-24tests/basics: Add test for calling a subclass of a native class.Damien George
Adding this test gets py/objtype.c to 100% coverage.
2018-02-24py/asm*.c: Remove unnecessary check for num_locals<0 in asm entry func.Damien George
All callers of the asm entry function guarantee that num_locals>=0, so no need to add an explicit check for it. Use an assertion instead. Also, the signature of asm_x86_entry is changed to match the other asm entry functions.
2018-02-24py/compile: Adjust c_assign_atom_expr() to use return instead of goto.Damien George
Makes the flow of the function a little more obvious, and allows to reach 100% coverage of compile.c when using gcov.
2018-02-23extmod/vfs_fat: Remove declaration of mp_builtin_open_obj.Damien George
It's declared already in py/builtin.h.
2018-02-23extmod/vfs_fat: Make fat_vfs_open_obj wrapper public, not its function.Damien George
This patch just moves the definition of the wrapper object fat_vfs_open_obj to the location of the definition of its function, which matches how it's done in most other places in the code base.
2018-02-23extmod/vfs_fat: Merge remaining vfs_fat_misc.c code into vfs_fat.c.Damien George
The only function left in vfs_fat_misc.c is fat_vfs_import_stat() which can logically go into vfs_fat.c, allowing to remove vfs_fat_misc.c.
2018-02-23extmod/vfs_fat: Move ilistdir implementation from misc to main file.Damien George
The fat_vfs_ilistdir2() function was only used by fat_vfs_ilistdir_func() so moving the former into the same file as the latter allows it to be placed directly into the latter function, thus saving code size.
2018-02-23stm32: Move MCU-specific cfg from mphalport.h to mpconfigboard_common.h.Damien George
It's cleaner to have all the MCU-specific configuration in one location, not least to help with adding support for a new MCU series.
2018-02-23stm32/flash: Use FLASH_TYPEPROGRAM_WORD to support newer HALs.Damien George
2018-02-23stm32: Use "GEN" for describing files generated in the build.Damien George
Instead of "Create", to match the build output from the py/ core.
2018-02-23examples/embedding: Don't prefix $(MPTOP) to ports/unix source files.Damien George
Otherwise the build process puts the corresponding output object files in two directories lower, not in build/ports/unix.
2018-02-22examples/embedding: Update broken paths to use correct $(MPTOP).talljosh
Some ".." need to be changed to $(MPTOP), and in some places "ports/" needs to be inserted to get to the "ports/unix/" subdir.
2018-02-22stm32: Add board config option to enable/disable the ADC.Damien George
The new option is MICROPY_HW_ENABLE_ADC and is enabled by default.
2018-02-22minimal/Makefile: Explicitly include lib/utils/printf.c in build.Damien George
The bare-metal port needs it and it's no longer included by default since the Makefile now uses $(PY_CORE_O).
2018-02-22py: Use "GEN" consistently for describing files generated in the build.Damien George
2018-02-22py/py.mk: Remove .. path component from list of extmod files.Damien George
This just makes it a bit cleaner in the output of the build process: instead of "CC ../../py/../extmod/" there is now "CC ../../extmod/".
2018-02-22ports/{bare-arm,minimal}/Makefile: Only build with core source files.Damien George
These ports don't need anything from extmod so don't include those files at all in the build. This speeds up the build by about 10% when building with a single core.
2018-02-22py/py.mk: Split list of uPy sources into core and extmod files.Damien George
If a port only needs the core files then it can now use the $(PY_CORE_O) variable instead of $(PY_O). $(PY_EXTMOD_O) contains the list of extmod files (including some files from lib/). $(PY_O) retains its original definition as the list of all object file (including those for frozen code) and is a convenience variable for ports that want everything.
2018-02-21py/objdeque: Use m_new0 when allocating items to avoid need to clear.Damien George
Saves a few bytes of code space, and is more efficient because with MICROPY_GC_CONSERVATIVE_CLEAR enabled by default all memory is already cleared when allocated.
2018-02-21py/objdeque: Protect against negative maxlen in deque constructor.Damien George
Otherwise passing -1 as maxlen will lead to a zero allocation and subsequent unbound buffer overflow in deque.append() because i_put is allowed to grow without bound.
2018-02-21tests/basics: Add tests to improve coverage of py/objdeque.c.Damien George
2018-02-21tests/basics/deque*: Tests for ucollections.deque.Paul Sokolovsky
2018-02-21ports: Enable ucollections.deque on relevant ports.Damien George
These ports are all capable of running uasyncio.
2018-02-21py/objdeque: Allow to compile without warnings by disabling deque_clear.Damien George
2018-02-21py/objdeque: Implement ucollections.deque type with fixed size.Paul Sokolovsky
So far, implements just append() and popleft() methods, required for a normal queue. Constructor doesn't accept an arbitarry sequence to initialize from (am empty deque is always created), so an empty tuple must be passed as such. Only fixed-size deques are supported, so 2nd argument (size) is required. There's also an extension to CPython - if True is passed as 3rd argument, append(), instead of silently overwriting the oldest item on queue overflow, will throw IndexError. This behavior is desired in many cases, where queues should store information reliably, instead of silently losing some items.
2018-02-21esp32/modsocket: Allow getaddrinfo() to take up to 6 args.Damien George
Currently only the first 2 args are used, but this patch should at least make getaddrinfo() signature-compatible with CPython and other bare-metal ports that use the lwip bindings.
2018-02-21esp32/main: Allocate the uPy heap via malloc instead of on the bss.Damien George
This allows to get slightly more memory for the heap (currently around 110k vs previous 92k) because the ESP IDF frees up some RAM after booting up.
2018-02-21esp32: Update to the latest ESP IDF.Damien George
This update requires a new ESP32 toolchain: 1.22.0-80-g6c4433a-5.2.0.
2018-02-21py/objint: Use MP_OBJ_IS_STR_OR_BYTES macro instead of 2 separate ones.Damien George
2018-02-20py/objstr: Remove unnecessary check for positive splits variable.Damien George
At this point in the code the variable "splits" is guaranteed to be positive due to the check for "splits == 0" above it.
2018-02-20py/modmicropython: Allow to have stack_use() func without mem_info().Damien George
The micropython.stack_use() function is useful to query the current C stack usage, and it's inclusion in the micropython module doesn't need to be tied to the inclusion of mem_info()/qstr_info() because it doesn't rely on any of the code from these functions. So this patch introduces the config option MICROPY_PY_MICROPYTHON_STACK_USE which can be used to independently control the inclusion of stack_use(). By default it is enabled if MICROPY_PY_MICROPYTHON_MEM_INFO is enabled (thus not changing any of the existing ports).