| Age | Commit message (Collapse) | Author |
|
For ports that have a system malloc which is not garbage collected (eg
unix, esp32), the stream object for the DB must be retained separately to
prevent it from being reclaimed by the MicroPython GC (because the
berkeley-db library uses malloc to allocate the DB structure which stores
the only reference to the stream).
Although in some cases the user code will explicitly retain a reference to
the underlying stream because it needs to call close() on it, this is not
always the case, eg in cases where the DB is intended to live forever.
Fixes issue #5940.
|
|
This test now passes given the previous two commits.
|
|
Follow up to 8e048d2548867aac743866ca5a4c244b7b5aac09 which missed these.
|
|
This commit adds Loop.new_event_loop() which is used to reset the singleton
event loop. This functionality is put here instead of in Loop.close() to
make it possible to write code that is compatible with CPython.
|
|
The amount of free space on the VfsLfs2 filesystem after creating a large
file is reduced by 2 blocks in this test.
|
|
|
|
|
|
This adds the Python files in the tests/ directory to be formatted with
./tools/codeformat.py. The basics/ subdirectory is excluded for now so we
aren't changing too much at once.
In a few places `# fmt: off`/`# fmt: on` was used where the code had
special formatting for readability or where the test was actually testing
the specific formatting.
|
|
All .exp files are included because they require CPython 3.8 which may not
always be available.
|
|
Fixes UDP non-blocking recv so it returns EAGAIN instead of ETIMEDOUT.
Timeout waiting for incoming data is also improved by replacing 100ms delay
with poll_sockets(), as is done in other parts of this module.
Fixes issue #5759.
|
|
STATE_NEW will return HUP when polled so put active UDP sockets into a new
state which is different to STATE_NEW.
Fixes issue #5758.
|
|
|
|
|
|
|
|
It tests independent functionality and may need to be skipped for a given
port.
|
|
So accessing the seek offset (at the C level) doesn't cause an
OverflowError on 32-bit targets.
|
|
Following CPython, OrderedDict are dumped with the syntax of dict.
|
|
|
|
|
|
Also rename SEC_COUNT to BLOCK_COUNT and SEC_SIZE to BLOCK_SIZE.
|
|
|
|
|
|
Fixes issues #3178 and #5220.
Tests are added, including all the cases mentioned in both bugs.
|
|
Because this functionality was introduced in Python 3.6.
|
|
CPython allows this, and it can be useful to reduce the number of memory
allocations.
Fixes issue #5031.
|
|
Enabled via MICROPY_PY_URE_DEBUG, disabled by default (but enabled on unix
coverage build). This is a rarely used feature that costs a lot of code
(500-800 bytes flash). Debugging of regular expressions can be done
offline with other tools.
|
|
JSON requires that keys of objects be strings. CPython will therefore
automatically quote simple types (NoneType, bool, int, float) when they are
used directly as keys in JSON output. To prevent subtle bugs and emit
compliant JSON, MicroPython should at least test for such keys so they
aren't silently let through. Then doing the actual quoting is a similar
cost to raising an exception, so that's what is implemented by this patch.
Fixes issue #4790.
|
|
Fixes issue #4780.
|
|
Selectable at compile time via MICROPY_PY_UCRYPTOLIB_CTR. Disabled by
default.
|
|
Now that setblocking() is implemented in modussl_axtls, it calls into the
underlying stream object, and io.BytesIO doesn't have setblocking().
|
|
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.
|
|
|
|
|
|
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`.
|
|
|
|
|
|
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.
|
|
On almost all realistic platforms, native layout should be larger (or
equal) than packed layout.
|
|
Just a copy of uctypes_sizeof.py with minimal changes.
|
|
This test doesn't check the actual I/O behavior, just "static" invariants
like behavior on duplicate calls or calls when I/O object is not registered
with poller.
|
|
Based on tests/extmod/uhashlib_sha1.
|
|
|
|
Otherwise returning None indicates that the write would block and nothing
was actually written. Fixes issue #3990.
|
|
|
|
This feature is controlled at compile time by MICROPY_PY_URE_SUB, disabled
by default.
Thanks to @dmazzella for the original patch for this feature; see #3770.
|
|
This feature is controlled at compile time by
MICROPY_PY_URE_MATCH_SPAN_START_END, disabled by default.
Thanks to @dmazzella for the original patch for this feature; see #3770.
|
|
This feature is controlled at compile time by MICROPY_PY_URE_MATCH_GROUPS,
disabled by default.
Thanks to @dmazzella for the original patch for this feature; see #3770.
|
|
Tests for separate input and output buffer (alloc-free operation) and
the same writable buffer used as input and output (inplace operation).
|
|
|
|
|