| Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
|
|
|
|
Fix MicroPython #3176
Handle escape sequences inside regular expressions. This adds
handling for \a, \b, \f, \n, \r, \v and \\.
|
|
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.
|
|
Commit 95e70cd0ea6d 'time: Use 1970 epoch' changed epoch for the time
module, but not for other users. This patch does the same for the only
other core timeutils user: extmod/vfs_fat.c:fat_vfs_stat().
Other timeutils users: cc3200, esp8266 and stm32, are not changed.
Ports that don't use long ints, will still get wrong time values from
os.stat().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This behaviour of a NULL write C method on a stream that uses the write
adaptor objects is no longer supported. It was only ever used by the
coverage build for testing the fail path of mp_get_stream_raise().
|
|
expected API
|
|
|
|
|
|
This is a very convenient feature introduced in Python 3.6 by PEP 515.
|
|
For i2c.py: the accelerometer now uses the new I2C driver so need to
explicitly init the legacy i2c object to get the test working.
For pyb1.py: the legacy pyb.hid() call will crash if the USB_HID object is
not initialised.
|
|
This patch is a code optimisation, trading text bytes for speed. On
pyboard it's an increase of 0.06% in code size for a gain (in pystone
performance) of roughly 6.5%.
The patch optimises load/store/delete of attributes in user defined classes
by not looking up special accessors (@property, __get__, __delete__,
__set__, __setattr__ and __getattr_) if they are guaranteed not to exist in
the class.
Currently, if you do my_obj.foo() then the runtime has to do a few checks
to see if foo is a property or has __get__, and if so delegate the call.
And for stores things like my_obj.foo = 1 has to first check if foo is a
property or has __set__ defined on it.
Doing all those checks each and every time the attribute is accessed has a
performance penalty. This patch eliminates all those checks for cases when
it's guaranteed that the checks will always fail, ie no attributes are
properties nor have any special accessor methods defined on them.
To make this guarantee it checks all attributes of a user-defined class
when it is first created. If any of the attributes of the user class are
properties or have special accessors, or any of the base classes of the
user class have them, then it sets a flag in the class to indicate that
special accessors must be checked for. Then in the load/store/delete code
it checks this flag to see if it can take the shortcut and optimise the
lookup.
It's an optimisation that's pretty widely applicable because it improves
lookup performance for all methods of user defined classes, and stores of
attributes, at least for those that don't have special accessors. And, it
allows to enable descriptors with minimal additional runtime overhead if
they are not used for a particular user class.
There is one restriction on dynamic class creation that has been introduced
by this patch: a user-defined class cannot go from zero special accessors
to one special accessor (or more) after that class has been subclassed. If
the script attempts this an AttributeError is raised (see addition to
tests/misc/non_compliant.py for an example of this case).
The cost in code space bytes for the optimisation in this patch is:
unix x64: +528
unix nanbox: +508
stm32: +192
cc3200: +200
esp8266: +332
esp32: +244
Performance tests that were done:
- on unix x86-64, pystone improved by about 5%
- on pyboard, pystone improved by about 6.5%, from 1683 up to 1794
- on pyboard, bm_chaos (from CPython benchmark suite) improved by about 5%
- on esp32, pystone improved by about 30% (but there are caching effects)
- on esp32, bm_chaos improved by about 11%
|
|
This conditional import was only used to get the tests working on the unix
coverage build, which has now switched to use VFS by default so the uos
module alone has the required functionality.
|
|
|
|
This makes it possible to run-tests on the board itself.
|
|
Fixes assertion failures and segmentation faults when making calls like:
super(1, 1).x
|
|
Fixes assertion failures when the arguments to type() were not of valid
types, e.g., when making calls like:
type("", (), 3)
type("", 3, {})
|
|
Instance members are always treated as values, even if they are properties.
A test is added to show this is the case.
|
|
Reduces code size by:
bare-arm: -24
minimal x86: -72
unix x64: -200
unix nanbox: -72
stm32: -52
cc3200: -32
esp8266: -84
esp32: -24
|
|
Generators that are already executing cannot be reexecuted. This patch
puts in a check for such a case.
Thanks to @jepler for finding the bug.
|
|
As per CPython semantics. This feature is controlled by
MICROPY_PY_BUILTINS_ROUND_INT which is disabled by default.
|
|
Following outcome of recent fuzz testing and sanitizing by @jepler.
|
|
Human readable OSError messages
|
|
Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
|
|
|
|
These special methods are all available if MICROPY_PY_ALL_SPECIAL_METHODS
is enabled.
|
|
Printing of uPy floats can differ by the floating-point precision on
different architectures (eg 64-bit vs 32-bit x86), so it's not possible to
using printing of floats in some parts of this test. Instead we can just
check for equivalence with what is known to be the correct answer.
|
|
If MICROPY_PY_ALL_SPECIAL_METHODS is enabled then dir() will now delegate
to the special method __dir__ if the object it is listing has this method.
|
|
It now allows __getattr__ in a user type to raise AttributeError when the
attribute does not exist.
|
|
Commit e269cabe3ed8bed1b7181359febb686edbb748ae added a check that the
first argument to the to_bytes() method is an integer, and now uPy
follows CPython behaviour and raises a TypeError for this test.
Note: CPython checks the argument types before checking the number of
arguments, but uPy does it the other way around, so they give different
exception messages for this test, but still the same type, a TypeError.
|
|
.. these tests currently fail, but a subsequent commit will
fix them
|
|
|
|
Commit 68c28174d0e0ec3f6b1461aea3a0b6a1b84610bb implemented checking for
valid utf-8 data.
|
|
Commit 1e70fda69fcb4991eb60ed43e610f664ea1319e6 fixes this difference.
|
|
|
|
In adcall.py the pyb module may not be imported, so use ADCAll directly.
In dac.py the DAC object now prints more info, so update .exp file.
In spi.py the SPI should be deinitialised upon exit, so the test can run a
second time correctly.
|
|
If MICROPY_USE_INTERNAL_ERRNO is disabled, MP_EINVAL is not guaranteed
to have the value 22, so we cannot depend on OSError(22,).
Instead, to support any given port's errno values, without relying
on uerrno, we just check that the args[0] is positive.
|
|
.. some of these tests currently fail, but a subsequent commit will
fix them.
|