Damien George
ac11e89fa3
tests: For urandom test, use sys.exit() instead of sys.exit(1).
9 years ago
Damien George
0ae97f531d
tests: Add some tests for urandom module.
9 years ago
Dave Hylands
a17755ee8b
py: Add ustruct.pack_into and unpack_from
9 years ago
chrysn
f8ba2eca80
builtin property: accept keyword arguments
this allows python code to use property(lambda:..., doc=...) idiom.
named versions for the fget, fset and fdel arguments are left out in the
interest of saving space; they are rarely used and easy to enable when
actually needed.
a test case is included.
9 years ago
stijn
dea585f8ae
tests: Remove builtin_dict test
This is essentially a duplicate of obj_dict.py
9 years ago
Dave Hylands
66d0c1052a
extmod: Fix uctypes size calculation for bitfields
9 years ago
Damien George
3b936a5f4c
tests: Fix math_fun_special test so it passes with single prec float.
9 years ago
Damien George
b1fa907d56
tests: Allow float tests to run when MATH_SPECIAL_FUNCTIONS is disabled.
9 years ago
Damien George
ea8be373a9
py/inlinethumb: Remove 30-bit restriction on movwt instruction.
movwt can now move a full 32-bit constant into a register.
9 years ago
Damien George
22b2265053
py/parse: Improve constant folding to operate on small and big ints.
Constant folding in the parser can now operate on big ints, whatever
their representation. This is now possible because the parser can create
parse nodes holding arbitrary objects. For the case of small ints the
folding is still efficient in RAM because the folded small int is stored
inplace in the parse node.
Adds 48 bytes to code size on Thumb2 architecture. Helps reduce heap
usage because more constants can be computed at compile time, leading to
a smaller parse tree, and most importantly means that the constants don't
have to be computed at runtime (perhaps more than once). Parser will now
be a little slower when folding due to calls to runtime to do the
arithmetic.
9 years ago
Damien George
d4df8f4925
py/objstr: In str.format, handle case of no format spec for string arg.
Handles, eg, "{:>20}".format("foo"), where there is no explicit spec for
the type of the argument.
9 years ago
Paul Sokolovsky
ee7b8f32e3
tests/object_dict.py: Add test for obj.__dict__ .
9 years ago
stijn
3c014a67ea
py: Implement __dict__ for instances.
Note that even though wrapped in MICROPY_CPYTHON_COMPAT, it is not
fully compatible because the modifications to the dictionary do not
propagate to the actual instance members.
10 years ago
Dave Hylands
7281d95aee
py: Make dir report instance members
9 years ago
Antonin ENFRUN
b50030b1d0
tests/uctypes: Test item assignment for scalar arrays.
9 years ago
Damien George
e5ce5e2a43
tests: Skip class_bind_self.py for native emitter.
9 years ago
Damien George
78913211a9
py: Be more restrictive binding self when looking up instance attrs.
When looking up and extracting an attribute of an instance, some
attributes must bind self as the first argument to make a working method
call. Previously to this patch, any attribute that was callable had self
bound as the first argument. But Python specs require the check to be
more restrictive, and only functions, closures and generators should have
self bound as the first argument
Addresses issue #1675 .
9 years ago
Damien George
7ce8860b6b
tests: Skip try-finally test for native emitter.
9 years ago
Damien George
8047340d75
py: Handle case of return within the finally block of try-finally.
Addresses issue #1636 .
9 years ago
Damien George
117158fcd5
tests: Add tests for stream IO errors.
9 years ago
Paul Sokolovsky
664bc44f30
tests: Add tests for %-formatting of bytes.
This requires CPython3.5, to not require switching to it, just use .exp
file.
9 years ago
Michael Buesch
17298af61e
py/modmath: Add domain error checking to sqrt, log, log2, log10.
These functions will raise 'ValueError: math domain error' on invalid
input.
9 years ago
Damien George
29e9db0c58
py: Fix compiler to handle lambdas used as default arguments.
Addresses issue #1709 .
9 years ago
Paul Sokolovsky
a6eff059b9
unix: Rename "_os" module to "uos" for consistency with baremetal ports.
9 years ago
Damien George
de2a2e296b
tests: Add test for "not" of a user defined class.
9 years ago
Henrik Sölver
e242b1785f
py/emitinlinethumb: Add support for MRS instruction.
Only IPSR and BASEPRI special registers supported at the moment, but easy
to extend in the future.
9 years ago
Dave Hylands
5a4a2b1db3
extmod: Add test which demonstrates LITTLE_ENDIAN packing failure
9 years ago
Damien George
3ff259a262
py: Fix calling of parent classmethod from instance of subclass.
Addresses issue #1697 .
9 years ago
Damien George
0891cf7d2d
tests: Disable for_range.py test for native emitter (it requires yield).
9 years ago
Damien George
33ac0fd09f
py: Don't try to optimise for+range when args are not simple expressions.
Addresses issue #1693 .
9 years ago
Paul Sokolovsky
55995869e5
tests/builtin_minmax: Make compatible with @native codegen.
9 years ago
Paul Sokolovsky
36c6d2fa7d
tests/builtin_minmax: Add testcase for lazy iterable (generator).
9 years ago
pohmelie
e23d5a64cf
tests: Add min/max "default" agrument test
9 years ago
Paul Sokolovsky
cbc489dff5
tests: Actuall add feature check for complex type being available.
9 years ago
Paul Sokolovsky
eed2f36ae2
tests/run-tests: Allow to skip complex tests if it's not compiled in.
9 years ago
Paul Sokolovsky
54a1d9ecb7
tests/extra_coverage: Update for sys.modules addition.
9 years ago
Damien George
7a99639cff
py: Fix function calls that have positional and a star-arg-with-iterator.
Addresses issue #1678 .
9 years ago
Damien George
0d9b450701
stmhal: Make uart.write() function correctly for timeout=0.
In non-blocking mode (timeout=0), uart.write() can now transmit all of its
data without raising an exception. uart.read() also works correctly in
this mode.
As part of this patch, timout_char now has a minimum value which is long
enough to transfer 1 character.
Addresses issue #1533 .
9 years ago
Ryan Shaw
f99491cbf7
stmhal: uart.any() function now returns number of bytes available.
9 years ago
Paul Sokolovsky
ff8c4188f4
tests/run-tests: Improve robustness of REPL tests.
Unconditionally wait for MicroPython banner. On overloaded systems, when
using emulators, etc. initial executable startup may take more than 20ms.
9 years ago
Damien George
9a56912ad1
py/compile: Do proper checking of * and ** in function definition.
This patch checks that there is only one *, and that ** is last in the
arg list.
9 years ago
Damien George
0e3f29cc99
py: Check that second argument to hasattr is actually a string.
Fixes issue #1623 .
9 years ago
Paul Sokolovsky
4120f32292
tests/int_big_*: Add more tests for result normalization.
Tested by comparability to small int/casting to bool.
9 years ago
Paul Sokolovsky
b56c635d64
tests/int_big_xor: Test that xor result is normalized.
And thus can be successfully used in comparisons, etc.
9 years ago
Paul Sokolovsky
b64e0575fd
tests/float/string_format: Add testcase for incorrect rounding for %f.
9 years ago
Damien George
2c83894257
py: Implement default and star args for lambdas.
9 years ago
danicampora
e4404fbef0
cc3200: Unmount all user file systems after a soft reset.
9 years ago
Paul Sokolovsky
772f0b4159
tests/jni: Add test for working with container of List interface.
9 years ago
Henrik Sölver
35e7d9c0f1
stmhal/can: Fix a bug in filter handling.
Reported here: http://forum.micropython.org/viewtopic.php?f=2&t=845
9 years ago
Paul Sokolovsky
aee704ebe1
extmod/modure: Make sure that errors in regexps are caught early.
9 years ago