MicroPython v1.9.2 Release Notes

Release Date: 2017-08-23 // over 6 years ago
  • ๐Ÿš€ This release brings general improvements and bug fixes to the core and
    ๐Ÿ“š various ports, as well as documentation additions, clean-ups and better
    consistency. And effort has been made to clean up the source code to
    ๐Ÿ‘‰ make it more consistent across the core and all ports.

    There is a new tool "mpy_bin2res.py" to convert arbitrary (binary) files
    to Python resources for inclusion in source code (frozen or otherwise).

    ๐Ÿ‘€ The ussl module has seen improvements, including implementation of
    server_hostname (for axtls) and server_side mode (for mbedtls).

    ๐Ÿ‘ There is now a double-precision float math library and stmhal has support
    ๐Ÿ— to build firmware with software or hardware double-precision.

    A detailed list of changes follows.

    py core:

    • formatfloat: fix number of digits and exponent sign when rounding
    • ๐Ÿš€ modthread: raise RuntimeError in release() if lock is not acquired
    • compile: raise SyntaxError if positional args are given after /*
    • ๐Ÿ‘ objint: support "big" byte-order in int.to_bytes()
    • objint: in to_bytes(), allow length arg to be any int and check sign
    • compile: fix bug with break/continue in else of optimised for-range
    • compile: optimise emitter label indices to save a word of heap
    • ๐Ÿšš builtinimport: remove unreachable code for relative imports
    • ๐Ÿ— objnamedtuple: simplify and remove use of alloca building namedtuple
    • mpprint: remove unreachable check for neg return of mp_format_float
    • binary: add missing "break" statements
    • runtime: mark m_malloc_fail() as NORETURN
    • ๐Ÿšš objstr: remove unnecessary "sign" variable in formatting code
    • vm: make "if" control flow more obvious in YIELD_FROM opcode
    • ๐ŸŒฒ modmath: check for zero division in log with 2 args
    • ๐Ÿš€ makeversionhdr.py: update to parse new release line in docs/conf.py
    • objdict: factorise dict accessor helper to reduce code size
    • change mp_uint_t to size_t in builtins code
    • repl: change mp_uint_t to size_t in repl helpers
    • compile: combine arith and bit-shift ops into 1 compile routine
    • compile: use switch-case to match token and operator
    • objgenerator: allow to hash generators and generator instances
    • ๐Ÿ”จ gc: refactor assertions in gc_free function
    • vm: make n_state variable local to just set-up part of VM
    • ๐Ÿ‘ asmx64: support moving a 64-bit immediate to one of top 8 registers
    • ๐Ÿ–จ modmicropython: cast stack_limit value so it prints correctly
    • builtinevex: add typechecking of globals/locals args to eval/exec
    • py.mk: make berkeley-db C-defs apply only to relevant source files
    • mperrno: allow mperrno.h to be correctly included before other hdrs
    • mpz: make mpz_is_zero() an inline function
    • implement raising a big-int to a negative power
    • mkrules.mk: show frozen modules sizes together with executable size
    • objtuple: allow to use inplace-multiplication operator on tuples
    • ๐Ÿ‘ป objstr: raise an exception for wrong type on RHS of str binary op
    • modsys: initial implementation of sys.getsizeof()
    • binary.c: fix bug when packing big-endian 'Q' values
    • add verbose debug compile-time flag MICROPY_DEBUG_VERBOSE
    • binary: change internal bytearray typecode from 0 to 1
    • objstringio: prevent offset wraparound for io.BytesIO objects
    • ๐Ÿ‘€ objstringio: fix regression with handling SEEK_SET
    • ๐Ÿ‘€ stream: seek: Consistently handle negative offset for SEEK_SET
    • mkrules.mk: use "find -path" when searching for frozen obj files
    • ๐Ÿšš compile: remove unused pn_colon code when compiling func params
    • ๐Ÿšš objcomplex: remove unnecessary assignment of variable
    • formatfloat: don't post-increment variable that won't be used again
    • ๐Ÿ‘‰ use "static inline" for funcs that should be inline
    • asmthumb: use existing macro to properly clear the D-cache

    extmod:

    • โšก๏ธ modussl_axtls: update for axTLS 2.1.3
    • modussl_axtls: implement server_hostname arg to wrap_socket()
    • ๐Ÿšš move modonewire.c from esp8266 to extmod directory
    • modure: if input string is bytes, return bytes results too
    • modubinascii: add check for empty buffer passed to hexlify
    • modussl_axtls: allow to close ssl stream multiple times
    • ๐Ÿ‘ modussl_mbedtls: support server_side mode
    • modussl_mbedtls: when reading and peer wants to close, return 0
    • modframebuf: fix invalid stride for odd widths in GS4_HMSB fmt
    • ๐Ÿ†“ modussl_mbedtls: make socket.close() free all TLS resources
    • modframebuf: consistently use "col" as name for colour variables
    • modussl_mbedtls: implement non-blocking SSL sockets
    • ๐Ÿšฆ machine_signal: fix parsing of invert arg when Pin is first arg
    • modframebuf: use correct initialization for .locals_dict
    • โž• modlwip: implement setsockopt(IP_ADD_MEMBERSHIP)
    • modussl_mbedtls.c: add ussl.getpeercert() method
    • modubinascii: rewrite mod_binascii_a2b_base64
    • modubinascii: don't post-increment variable that won't be used
    • modonewire: rename public module to mp_module_onewire
    • for uos.stat interpret st_size member as an unsigned int
    • ๐Ÿ‘‰ use "static inline" for funcs that should be inline

    lib:

    • โฌ†๏ธ axtls: upgrade to axTLS 2.1.3 + MicroPython patchset
    • ๐Ÿšš libm/math: remove implementations of float conversion functions
    • โž• add libm_dbl, a double-precision math library, from musl-1.1.16

    drivers:

    • ๐Ÿšš onewire: move onewire.py, ds18x20.py from esp8266 to drivers
    • ๐Ÿ“Œ onewire: enable pull-up when init'ing the 1-wire pin

    tools:

    • gen-cpydiff: use case description as 3rd-level heading
    • pyboard: add license header
    • mpy_bin2res: tools to convert binary resources to Python module
    • mpy-tool.py: don't generate const_table if it's empty
    • mpy-tool.py: fix missing argument in dump() function

    โœ… tests:

    • โœ… net_inet/test_tls_sites.py: integration test for SSL connections
    • โœ… net_inet: add tests for accept and connect in nonblocking mode
    • โœ… basics: add tests for for-else statement
    • ๐Ÿšš net_inet: move tests which don't require full Internet to net_hosted
    • ๐Ÿ”จ connect_nonblock: refactor towards real net_hosted test
    • auto detect floating point capabilites of the target
    • import: add a test for the builtin import function
    • โšก๏ธ import: update comment now that uPy raises correct exception
    • โœ… basics/namedtuple1: add test for creating with pos and kw args
    • โœ… unix/extra_coverage: add test for mp_vprintf with bad fmt spec
    • โœ… basics: add tests for arithmetic operators precedence
    • โ†ช cpydiff/modules_deque: elaborate workaround
    • cpydiff/core_class_mro: move under Classes, add workaround
    • ๐Ÿšš cpydiff/core_arguments: move under Functions subsection
    • cpydiff/core_class_supermultiple: same cause as core_class_mro
    • โ†ช cpydiff: improve wording, add more workarounds
    • cpydiff: add case for str.ljust/rjust
    • ๐Ÿ“‡ rename exec1.py to builtin_exec.py
    • โœ… basics/builtin_exec: test various globals/locals args to exec()

    minimal port:

    • ๐Ÿšš Makefile: enable gc-sections to remove unused code
    • โœ‚ remove unused stmhal include from Makefile
    • use size_t for mp_builtin_open argument

    unix port:

    • modtime: replace strftime() with localtime()
    • โšก๏ธ mpconfigport.mk: update descriptions of readline and TLS options
    • ๐Ÿ‘‰ Makefile: disable assertions in the standard unix executable
    • modjni: convert to mp_rom_map_elem_t
    • for uos.stat interpret st_size member as an unsigned int

    stmhal port:

    • mpconfigport.h: remove config of PY_THREAD_GIL to use default
    • ๐Ÿ‘‰ make error messages more consistent across peripherals
    • โž• add initial implementation of Pin.irq() method
    • โž• add .value() method to Switch object, to mirror Pin and Signal
    • move pybstdio.c to lib/utils/sys_stdio_mphal.c for common use
    • โž• add "quiet timing" enter/exit functions
    • ๐Ÿ‘‰ make available the _onewire module, for low-level bus control
    • modules: provide sym-link to onewire.py driver
    • boards/stm32f405.ld: increase FLASH_TEXT to end of 1MiB flash
    • sdcard: allow a board to customise the SDIO pins
    • โž• add possibility to build with double-precision floating point
    • boards: enable double-prec FP on F76x boards
    • ๐Ÿ‘‰ Makefile: use hardware double-prec FP for MCUs that support it
    • Makefile: rename FLOAT_IMPL to MICROPY_FLOAT_IMPL to match C name
    • ๐Ÿ‘‰ Makefile: add CFLAGS_EXTRA to CFLAGS so cmdline can add options
    • mpconfigport.h: allow MICROPY_PY_THREAD to be overridden
    • ๐Ÿ”ง boards: add configuration files for NUCLEO_F429ZI
    • boards/NUCLEO_F429ZI: change USB config from HS to FS peripheral
    • โฌ‡๏ธ reduce size of ESPRUINO_PICO build so it fits in flash
    • ๐Ÿ“Œ servo: make pyb.Servo(n) map to Pin('Xn') on all MCUs
    • servo: don't compile servo code when it's not enabled
    • ๐Ÿ‘‰ use "static inline" for funcs that should be inline

    cc3200 port:

    • modusocket: simplify socket.makefile() function
    • โฑ make non-zero socket timeout work with connect/accept/send
    • โฑ modusocket: fix connect() when in non-blocking or timeout mode
    • ๐Ÿ‘‰ use the name MicroPython consistently in code

    esp8266 port:

    • ๐Ÿ‘‰ Makefile: bump axTLS TLS record buffer size to 5K
    • Makefile: allow FROZEN_DIR,FROZEN_MPY_DIR to be overridden
    • Makefile: add LIB_SRC_C variable to qstr auto-extraction list
    • ๐Ÿ‘‰ make onewire module and support code usable by other ports
    • ๐Ÿšš modonewire: move low-level 1-wire bus code to modonewire.c
    • ๐Ÿšš modonewire: make timings static and remove onewire.timings func
    • reinstate 1-wire scripts by sym-linking to drivers/onewire/
    • move mp_hal_pin_open_drain from esp_mphal.c to machine_pin.c
    • enable MICROPY_ENABLE_FINALISER
    • ๐Ÿ“š README: make "Documentation" a top-level section
    • machine_rtc: use correct arithmetic for aligning RTC mem len
    • mpconfigport_512k: use terse error messages to get 512k to fit
    • mpconfigport.h: make socket a weak link
    • ๐Ÿšš modesp: remove unused constants: STA_MODE, etc
    • general: add known issue of WiFi RX buffers overflow
    • use size_t for mp_builtin_open argument
    • ๐Ÿ›  fix UART stop bit constants

    zephyr port:

    • ๐Ÿ‘‰ Makefile: rework dependencies and "clean" target
    • โช Makefile: revert prj.conf construction rule to the previous state
    • remove long-obsolete machine_ptr_t typedef's
    • 0๏ธโƒฃ Makefile: explicitly define default target as "all"
    • modusocket: allow to use socketized net_context in upstream
    • modusocket: socket, close: switch to native Zephyr socket calls
    • modusocket: bind, connect, listen, accept: Swtich to native sockets
    • modusocket: send: switch to native sockets
    • modusocket: recv: switch to native sockets
    • modusocket: fully switch to native Zephyr sockets
    • modzephyr: add current_tid() and stacks_analyze() functions
    • prj_base.conf: enable CONFIG_INIT_STACKS
    • โšก๏ธ modusocket: update struct sockaddr family field name
    • prj_96b_carbon.conf: re-enable networking on Carbon
    • modzephyr: add shell_net_iface() function

    ๐Ÿ“„ docs:

    • btree: add hints about opening db file and need to flush db
    • select: rename to uselect, to match the actual module name
    • โšก๏ธ license: update copyright year
    • esp8266/tutorial/intro: discourage use of 512kb firmwares
    • esp8266/tutorial/intro: Sphinx requires blank lines around literal blocks
    • conf.py: include 3 levels of ToC in latexpdf output
    • gc: mark mem_alloc()/mem_free() as uPy-specific
    • gc: document gc.threshold() function
    • builtins: list builtin exceptions
    • 0๏ธโƒฃ conf.py: set default_role = 'any'
    • lcd160cr: group related constants together and use full sentences
    • โšก๏ธ ref/speed_python: update and make more hardware-neutral
    • library/gc: fix grammar and improve readability of gc.threshold()
    • ๐Ÿšš move all ports docs to the single ToC
    • ๐Ÿšš topindex.html: remove link to wipy.io, it's no longer available
    • conf.py: add .venv dir to exclude_patterns
    • ๐Ÿšš move topindex.html to templates/ subdir
    • differences/index_template: use consistent heading casing
    • builtins: add AssertionError, SyntaxError, ZeroDivisionError
    • โž• add glossary
    • conf.py: switch to "new" format of intersphinx_mapping
    • conf.py: add file for global replacements definition
    • ๐Ÿ“„ library: add CPython docs xref to each pertinent module
    • ๐Ÿ‘€ replace.inc: add |see_cpython|, to xref individual symbols from CPython
    • ๐Ÿš€ conf.py: set "version" and "release" to the same value
    • *_index: drop "Indices and tables" pseudo-section
    • ๐Ÿšš pyboard: move hardware info into General Info chapter
    • uerrno: document "uerrno" module
    • esp8266/general.rst: fix name of NTP module
    • ๐Ÿ pyboard: move info about using Windows from topindex to general
    • โšก๏ธ uzlib: update description of decompress() and mention DecompIO
    • pyboard/tutorial/amp_skin: add example for playing large WAV files
    • โšก๏ธ library/ubinascii: update base64 docs
    • ๐Ÿšš library/usocket: move socket.error to its own section
    • library/usocket: describe complete information on address formats
    • glossary: elaborate on possible MicroPython port differences
    • โœ๏ธ glossary: fix typos in micropython-lib paragraph
    • index: rewrite introduction paragraph to avoid confusion
    • ๐Ÿ“š use the name MicroPython consistently in documentation
    • consistently link to micropython-lib in glossary

    all:

    • make more use of mp_raise_{msg,TypeError,ValueError} helpers
    • unify header guard usage
    • โœ‚ remove trailing spaces, per coding conventions
    • don't include system errno.h when it's not needed
    • ๐Ÿ‘‰ use the name MicroPython consistently in comments
    • ๐Ÿ‘‰ make use of $(TOP) variable in Makefiles, instead of ".."
    • raise exceptions via mp_raise_XXX
    • make static dicts use mp_rom_map_elem_t type and MP_ROM_xxx macros

    README:

    • ๐Ÿ‘ mention support for bytecode and frozen bytecode
    • ๐Ÿ‘Œ improve description of precompiled bytecode; mention mpy-cross

    CODECONVENTIONS:

    • clarify MicroPython changes sign-off process
    • ๐Ÿ“„ start to describe docs conventions
    • ๐Ÿ“„ describe docs use of markup for None/True/False

    travis:

    • ๐Ÿ— build STM32F769DISC board instead of F7DISC to test dbl-prec FP
    • ๐Ÿ“Œ pin cpp-coveralls at 0.3.12