- 03 Oct, 2017 6 commits
-
-
chrismas9 authored
Building mpy-cross: this patch adds .exe to the PROG name when building executables for host (eg mpy-cross) on Windows. make clean now removes mpy-cross.exe under Windows. Building MicroPython: this patch sets MPY_CROSS to mpy-cross.exe or mpy-cross so they can coexist and use cygwin or WSL without rebuilding mpy-cross. The dependency in the mpy rule now uses mpy-cross.exe for Windows and mpy-cross for Linux.
-
Damien George authored
Sending byte-by-byte is inefficient and leads to errors in the WebSocket protocol when sending utf-8 encoded characters.
-
Damien George authored
-
Damien George authored
-
Damien George authored
CPython docs explicitly state that the RHS of a set/frozenset binary op must be a set to prevent user errors. It also preserves commutativity of the ops, eg: "abc" & set() is a TypeError, and so should be set() & "abc". This change actually decreases unix (x64) code by 160 bytes; it increases stm32 by 4 bytes and esp8266 by 28 bytes (but previous patch already introduced a much large saving).
-
Damien George authored
A lot of set's methods (the mutable ones) are not allowed to operate on a frozenset, and giving frozenset a separate locals dict with only the methods that it supports allows to simplify the logic that verifies if args are a set or a frozenset. Even though the new frozenset locals dict is relatively large (88 bytes on 32-bit archs) there is a much bigger saving coming from the removal of a const string for an error message, along with the removal of some checks for set or frozenset type. Changes in code size due to this patch are (for ports that changed at all): unix x64: -56 unix nanbox: -304 stm32: -64 esp8266: -124 cc3200: -40 Apart from the reduced code, frozenset now has better tab-completion because it only lists the valid methods. And the error message for accessing an invalid method is now more detailed (it includes the method name that wasn't found).
-
- 02 Oct, 2017 3 commits
-
-
Paul Sokolovsky authored
These now should be caught properly and lead to RuntimeError instead of crash.
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
-
- 30 Sep, 2017 1 commit
-
-
Paul Sokolovsky authored
TLS SNI support, fixes after making str.rstrip() behavior compliant.
-
- 26 Sep, 2017 2 commits
-
-
Damien George authored
This returns a complex number, following CPython behaviour. For ports that don't have complex numbers enabled this will raise a ValueError which gives a fail-safe for scripts that were written assuming complex numbers exist.
-
David Lechner authored
This adds a new configuration option to print runtime warnings and errors to stderr. On Unix, CPython prints warnings and unhandled exceptions to stderr, so the unix port here is configured to use this option. The unix port already printed unhandled exceptions on the main thread to stderr. This patch fixes unhandled exceptions on other threads and warnings (issue #2838) not printing on stderr. Additionally, a couple tests needed to be fixed to handle this new behavior. This is done by also capturing stderr when running tests.
-
- 25 Sep, 2017 4 commits
-
-
Paul Sokolovsky authored
Not all can, so we don't need to reserve bytecodes for them, and can use free slots for something else later.
-
Anton Patrushev authored
A unix target should provide POSIX open/write/close functions regardless of its machine architecture. Fixes issue #3325.
-
Peter Hinch authored
It removes the need for a wrapper Python function to dispatch to the framebuf method which makes each function call a bit faster, roughly 2.5x. This patch also adds the rest of the framebuf methods to the SSD class.
-
Damien George authored
The timer prescaler is buffered by default, and this patch enables ARPE which buffers the auto-reload register. With both of these registers buffered it's now possible to smoothly change the timer's frequency and have a smoothly varying PWM output.
-
- 24 Sep, 2017 1 commit
-
-
Paul Sokolovsky authored
Allow literal minus in char classes to be in trailing position, e.g. [a-c-]. (Previously, minus was allowed only at the start.) This increases ARM Thumb2 code size by 8 bytes.
-
- 22 Sep, 2017 5 commits
-
-
Damien George authored
-
Damien George authored
-
Damien George authored
For consistency with all the other exception messages.
-
Damien George authored
-
Damien George authored
-
- 21 Sep, 2017 11 commits
-
-
Damien George authored
This is the final piece of USB device refactoring to support multiple USB device instances.
-
Damien George authored
-
Damien George authored
-
Damien George authored
-
Damien George authored
-
Damien George authored
-
Damien George authored
-
Damien George authored
-
Damien George authored
Current users of fixed vstr buffers (building file paths) assume that there is no overflow and do not check for overflow after building the vstr. This has the potential to lead to NULL pointer dereferences (when vstr_null_terminated_str returns NULL because it can't allocate RAM for the terminating byte) and stat'ing and loading invalid path names (due to the path being truncated). The safest and simplest thing to do in these cases is just raise an exception if a write goes beyond the end of a fixed vstr buffer, which is what this patch does. It also simplifies the vstr code.
-
Damien George authored
The vstr argument to the calls to vstr_add_len are dynamically allocated (ie fixed_buf=false) and so vstr_add_len will never return NULL. So there's no need to check for it. Any out-of-memory errors are raised by the call to m_renew in vstr_ensure_extra.
-
Damien George authored
The aim of this patch is to rewrite the functions that create exception instances (mp_obj_exception_make_new and mp_obj_new_exception_msg_varg) so that they do not call any functions that may raise an exception. Otherwise it's possible to create infinite recursion with an exception being raised while trying to create an exception object. The two main things that are done to accomplish this are: 1. Change mp_obj_new_exception_msg_varg to just format the string, then call mp_obj_exception_make_new to actually create the exception object. 2. In mp_obj_exception_make_new and mp_obj_new_exception_msg_varg try to allocate all memory first using functions that don't raise exceptions If any of the memory allocations fail (return NULL) then degrade gracefully by trying other options for memory allocation, eg using the emergency exception buffer. 3. Use a custom printer backend to conservatively format strings: if it can't allocate memory then it just truncates the string. As part of this rewrite, raising an exception without a message, like KeyError(123), will now use the emergency buffer to store the arg and traceback data if there is no heap memory available. Memory use with this patch is unchanged. Code size is increased by: bare-arm: +136 minimal x86: +124 unix x64: +72 unix nanbox: +96 stm32: +88 esp8266: +92 cc3200: +80
-
- 20 Sep, 2017 2 commits
-
-
Damien George authored
It's written straight away in the function on every call so it doesn't need to be static.
-
Damien George authored
-
- 19 Sep, 2017 1 commit
-
-
Paul Sokolovsky authored
An issue was due to incorrectly taking size of default strip characters set.
-
- 18 Sep, 2017 2 commits
-
-
Damien George authored
-
Damien George authored
-
- 17 Sep, 2017 2 commits
-
-
Paul Sokolovsky authored
This allows user classes to implement __abs__ special method, and saves code size (104 bytes for x86_64), even though during refactor, an issue was fixed and few optimizations were made: * abs() of minimum (negative) small int value is calculated properly. * objint_longlong and objint_mpz avoid allocating new object is the argument is already non-negative.
-
Paul Sokolovsky authored
-