| Age | Commit message (Collapse) | Author |
|
"Builtin" tinytest-based testsuite as employed by qemu-arm (and now
generalized by me to be reusable for other targets) performs simplified
detection of skipped tests, it treats as such tests which raised SystemExit
(instead of checking got "SKIP" output). Consequently, each "SKIP" must
be accompanied by SystemExit (and conversely, SystemExit should not be
used if test is not skipped, which so far seems to be true).
|
|
|
|
|
|
|
|
|
|
|
|
Because a lot of string processing functions assume there is a null
terminating byte, so they can work in an efficient way.
Fixes issue #3334.
|
|
|
|
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).
|
|
An issue was due to incorrectly taking size of default strip characters
set.
|
|
This test should be run only if support for reverse ops is enabled, so
the corresponding feature_check is added to run-tests.
|
|
Should raise TypeError, unless it's (in)equality comparison.
|
|
Should raise TypeError, unless it's (in)equality comparison.
|
|
|
|
Prior to this patch, the size of the buffer given to pack_into() was checked
for being too small by using the count of the arguments, not their actual
size. For example, a format spec of '4I' would only check that there was 4
bytes available, not 16; and 'I' would check for 1 byte, not 4.
The pack() function is ok because its buffer is created to be exactly the
correct size.
The fix in this patch calculates the total size of the format spec at the
start of pack_into() and verifies that the buffer is large enough. This
adds some computational overhead, to iterate through the whole format spec.
The alternative is to check during the packing, but that requires extra
code to handle alignment, and the check is anyway not needed for pack().
So to maintain minimal code size the check is done using struct_calcsize.
|
|
Prior to this patch, the size of the buffer given to unpack/unpack_from was
checked for being too small by using the count of the arguments, not their
actual size. For example, a format spec of '4I' would only check that
there was 4 bytes available, not 16; and 'I' would check for 1 byte, not 4.
This bug is fixed in this patch by calculating the total size of the format
spec at the start of the unpacking function. This function anyway needs to
calculate the number of items at the start, so calculating the total size
can be done at the same time.
|
|
This patch makes a repeat counter behave the same as repeating the
typecode, when there are not enough args. For example:
struct.pack('2I', 1) now behave the same as struct.pack('II', 1).
|
|
Similar to the existing testcase, but test that returning both value of
native type and instance of another user class from __new__ lead to
__init__ not being called, for better coverage.
|
|
|
|
Make messages more verbose and easier to follow and check that user class'
__new__() is not called by object.__new__(user_class).
|
|
NotImplemented means "try other fallbacks (like calling __rop__
instead of __op__) and if nothing works, raise TypeError". As
MicroPython doesn't implement any fallbacks, signal to raise
TypeError right away.
|
|
Otherwise, it will silently get incorrect result on other values types,
including CPython tuple form like "foo.png".endswith(("png", "jpg"))
(which MicroPython doesn't support for unbloatedness).
|
|
The value of 0 can't be used because otherwise mp_binary_get_size will let
a null byte through as the type code (intepreted as byterray). This can
lead to invalid type-specifier strings being let through without an error
in the struct module, and even buffer overruns.
|
|
Without bugfix:
struct.pack('>Q', 16)
b'\x00\x00\x00\x10\x00\x00\x00\x00'
With bugfix:
struct.pack('>Q', 16)
b'\x00\x00\x00\x00\x00\x00\x00\x10'
|
|
The main case to catch is invalid types for the containment operator, of
the form str.__contains__(non-str).
|
|
|
|
There were several different spellings of MicroPython present in comments,
when there should be only one.
|
|
|
|
|
|
Adds nothing to the code size, since it uses existing empty slots in the
type structures.
|
|
|
|
|
|
|
|
|
|
|
|
In CPython 3.4 this raises a SyntaxError. In CPython 3.5+ having a
positional after * is allowed but uPy has the wrong semantics and passes
the arguments in the incorrect order. To prevent incorrect use of a
function going unnoticed it is important to raise the SyntaxError in uPy,
until the behaviour is fixed to follow CPython 3.5+.
|
|
|
|
|
|
|
|
These tests excercise cases that are fixed by the previous two commits.
|
|
|
|
|
|
Tests for an issue with line continuation failing in paste mode due to the
lexer only checking for \n in the "following" character position, before
next_char() has had a chance to convert \r and \r\n to \n.
|
|
|
|
|
|
|
|
It's now possible to use the name "super" as a local variable.
|
|
The trailing zeros should be truncated from the converted value.
|
|
|
|
|