- May 21, 2019
-
-
stijn authored
Reuse the implementation for bytes since it works the same way regardless of the underlying type. This method gets added for CPython compatibility of bytearray, but to keep the code simple and small array.array now also has a working decode method, which is non-standard but doesn't hurt.
-
- May 14, 2019
-
-
Damien George authored
-
stijn authored
This allows figuring out the number of bytes in the memoryview object as len(memview) * memview.itemsize. The feature is enabled via MICROPY_PY_BUILTINS_MEMORYVIEW_ITEMSIZE and is disabled by default.
-
Damien George authored
Follow up to commit 34942d0a
-
Damien George authored
Fixes issue #4780.
-
- May 09, 2019
-
-
Damien George authored
Fixes issue #4527.
-
- May 06, 2019
-
-
Yonatan Goldschmidt authored
Selectable at compile time via MICROPY_PY_UCRYPTOLIB_CTR. Disabled by default.
-
- May 03, 2019
-
-
Damien George authored
-
Damien George authored
-
Damien George authored
Variables with type bool now act more like an int, and there is proper casting to/from Python objects.
-
- Apr 30, 2019
-
-
Paul Sokolovsky authored
Now that setblocking() is implemented in modussl_axtls, it calls into the underlying stream object, and io.BytesIO doesn't have setblocking().
-
Paul Sokolovsky authored
It consists of: 1. "do_handhake" param (default True) to wrap_socket(). If it's False, handshake won't be performed by wrap_socket(), as it would be done in blocking way normally. Instead, SSL socket can be set to non-blocking mode, and handshake would be performed before the first read/write request (by just returning EAGAIN to these requests, while instead reading/writing/ processing handshake over the connection). Unfortunately, axTLS doesn't really support non-blocking handshake correctly. So, while framework for this is implemented on MicroPython's module side, in case of axTLS, it won't work reliably. 2. Implementation of .setblocking() method. It must be called on SSL socket for blocking vs non-blocking operation to be handled correctly (for example, it's not enough to wrap non-blocking socket with wrap_socket() call - resulting SSL socket won't be itself non-blocking). Note that .setblocking() propagates call to the underlying socket object, as expected.
-
- Apr 28, 2019
-
-
Damien George authored
-
- Apr 18, 2019
-
-
Damien George authored
This adds tests for some locations in the code where a memory allocation should raise an exception.
-
- Apr 04, 2019
-
-
stijn authored
When running Linux on WSL, Popen.kill() can raise a ProcessLookupError if the process does not exist anymore, which can happen here since the previous statement already tries to close the process by sending Ctrl-D to the running repl. This doesn't seem to be a problem on other OSes, so just swallow the exception silently since it indicates the process has been closed already, which after all is what we want.
-
- Mar 26, 2019
-
-
Damien George authored
-
Andrew Leech authored
This means the schedule operates on a first-in, first-executed manner rather than the current last-in, first executed.
-
- Mar 08, 2019
-
-
Damien George authored
-
Damien George authored
-
- Mar 05, 2019
-
-
Damien George authored
This is an implementation of a sliding qstr window used to reduce the number of qstrs stored in a .mpy file. The window size is configured to 32 entries which takes a fixed 64 bytes (16-bits each) on the C stack when loading/saving a .mpy file. It allows to remember the most recent 32 qstrs so they don't need to be stored again in the .mpy file. The qstr window uses a simple least-recently-used mechanism to discard the least recently used qstr when the window overflows (similar to dictionary compression). This scheme only needs a single pass to save/load the .mpy file. Reduces mpy file size by about 25% with a window size of 32.
-
Damien George authored
POP_BLOCK and POP_EXCEPT are now the same, and are always followed by a JUMP. So this optimisation reduces code size, and RAM usage of bytecode by two bytes for each try-except handler.
-
Damien George authored
This patch fixes a bug in the VM when breaking within a try-finally. The bug has to do with executing a break within the finally block of a try-finally statement. For example: def f(): for x in (1,): print('a', x) try: raise Exception finally: print(1) break print('b', x) f() Currently in uPy the above code will print: a 1 1 1 segmentation fault (core dumped) micropython Not only is there a seg fault, but the "1" in the finally block is printed twice. This is because when the VM executes a finally block it doesn't really know if that block was executed due to a fall-through of the try (no exception raised), or because an exception is active. In particular, for nested finallys the VM has no idea which of the nested ones have active exceptions and which are just fall-throughs. So when a break (or continue) is executed it tries to unwind all of the finallys, when in fact only some may be active. It's questionable whether break (or return or continue) should be allowed within a finally block, because they implicitly swallow any active exception, but nevertheless it's allowed by CPython (although almost never used in the standard library). And uPy should at least not crash in such a case. The solution here relies on the fact that exception and finally handlers always appear in the bytecode after the try body. Note: there was a similar bug with a return in a finally block, but that was previously fixed in b7352084
-
- Feb 26, 2019
-
-
Damien George authored
All exceptions that unwind through the async-with must be caught and BaseException is the top-level class, which includes Exception and others. Fixes issue #4552.
-
- Feb 21, 2019
-
-
Damien George authored
-
- Feb 13, 2019
-
-
Yonatan Goldschmidt authored
As mentioned in #4450, `websocket` was experimental with a single intended user, `webrepl`. Therefore, we'll make this change without a weak link `websocket` -> `uwebsocket`.
-
- Jan 27, 2019
-
-
stijn authored
Configurable via MICROPY_PY_BUILTINS_NEXT2, disabled by default.
-
- Dec 12, 2018
-
-
Paul Sokolovsky authored
-
- Dec 10, 2018
-
-
Damien George authored
-
Paul Sokolovsky authored
-
- Dec 07, 2018
-
-
Paul Sokolovsky authored
-
- Dec 06, 2018
-
-
Damien George authored
Instead of assuming that the method is a bytecode object, and only supporting load of __name__, make the operation generic by delegating the load to the method object itself. Saves a bit of code size and fixes the case of attempting to load __name__ on a native method, see issue #4028.
-
- Dec 05, 2018
-
-
Damien George authored
As per the machine.UART documentation, this is used to set the length of the RX buffer. The legacy read_buf_len argument is retained for backwards compatibility, with rxbuf overriding it if provided.
-
- Dec 04, 2018
-
-
Damien George authored
Also change the order of printing of flow so it is after stop (so bits, parity, stop are one after the other), and reduce code size by using mp_print_str instead of mp_printf where possible. See issue #1981.
-
- Nov 26, 2018
-
-
Paul Sokolovsky authored
After Unix port switches from one to another, to be consistent with baremetal ports.
-
Damien George authored
-
- Nov 01, 2018
-
-
Paul Sokolovsky authored
Such names aren't stored as qstr in module dict, and there was a bug in "import *" handling which assumed any name in a module dict is a qstr.
-
- Oct 30, 2018
-
-
stijn authored
CPython does not have an implementation of select.poll() on some operating systems (Windows, OSX depending on version) so skip the test in those cases instead of failing it.
-
- Oct 27, 2018
-
-
Damien George authored
This ensures that implicit variables are only converted to implicit closed-over variables (nonlocals) at the very end of the function scope. If variables are closed-over when first used (read from, as was done prior to this commit) then this can be incorrect because the variable may be assigned to later on in the function which means they are just a plain local, not closed over. Fixes issue #4272.
-
Damien George authored
The way it was written previously the variable x was not an implicit nonlocal, it was just a normal local (but the compiler has a bug which incorrectly makes it a nonlocal).
-
- Oct 23, 2018
-
-
Damien George authored
-