| Age | Commit message (Collapse) | Author |
|
This commit adds human readable error messages when mbedtls or axtls raise
an exception. Currently often just an EIO error is raised so the user is
lost and can't tell whether it's a cert error, buffer overrun, connecting
to a non-ssl port, etc. The axtls and mbedtls error raising in the ussl
module is modified to raise:
OSError(-err_num, "error string")
For axtls a small error table of strings is added and used for the second
argument of the OSErrer. For mbedtls the code uses mbedtls' built-in
strerror function, and if there is an out of memory condition it just
produces OSError(-err_num). Producing the error string for mbedtls is
conditional on them being included in the mbedtls build, via
MBEDTLS_ERROR_C.
|
|
Fixes issue #6107.
|
|
Saves about 500 bytes on unix x64 and enables CPython-conform
usage of passing a re object to these functions.
|
|
Fixes issue #6069.
|
|
CPython semantics require searching the current directory if the import is
not absolute (when "" is in sys.path).
Fixes issue #6037.
|
|
If the new name start with '/', cur_dir is not prepened any more, so that
the current working directory is respected. And extend the test cases for
rename to cover this functionality.
|
|
This change scans for '.', '..' and multiple '/' and normalizes the new
path name. If the resulting path does not exist, an error is raised.
Non-existing interim path elements are ignored if they are removed during
normalization.
|
|
This fixes the bug, that stat(filename) would not consider the current
working directory. So if e.g. the cwd is "lib", then stat("main.py") would
return the info for "/main.py" instead of "/lib/main.py".
|
|
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.
|
|
|