Damien George
b2e731177e
py: Implement +, += and .extend for bytearray and array objs.
...
Addresses issue #994 .
2014-11-30 00:00:55 +00:00
Damien George
7288403b9b
tests: Split out float test from builtin_round.py.
2014-11-29 14:47:54 +00:00
Henrik Sölver
acb92c186c
Adding CAN filter management
2014-11-26 18:52:33 +00:00
Paul Sokolovsky
4a1c80c293
tests: Add test for hashlib.sha256 .
2014-11-22 14:54:02 +02:00
Damien George
c9f8f653ad
py: Add support for float/double arrays in array module.
...
Addresses issue #981 .
2014-11-21 18:16:25 +00:00
blmorris
9d1ca65b59
Set PYTHONIOENCODING='utf-8' so that unicode tests can pass on CPython on
...
systems where another encoding is set in the locale
2014-11-19 10:44:31 -05:00
Damien George
5694cc5490
py: Make stream seek correctly check for ioctl fn; add seek for textio.
2014-11-16 23:56:37 +00:00
Paul Sokolovsky
c7d5500142
tests: Add test for file.seek().
2014-11-17 00:16:14 +02:00
Damien George
224fee0e10
stmhal: Fix HAL error raising; make test for it.
...
Addresses issue #968 .
2014-11-15 20:39:44 +00:00
Damien George
4df85e49d4
tests: Add test for hash of user defined class.
2014-11-15 18:30:01 +00:00
Damien George
a65c03c6c0
py: Allow +, in, and compare ops between bytes and bytearray/array.
...
Eg b"123" + bytearray(2) now works. This patch actually decreases code
size while adding functionality: 32-bit unix down by 128 bytes, stmhal
down by 84 bytes.
2014-11-05 16:30:34 +00:00
Damien George
0344fa1ddf
py: Fix builtin callable so it checks user-defined instances correctly.
...
Addresses issue #953 .
2014-11-03 16:09:39 +00:00
Paul Sokolovsky
039887a0ac
py: Fix bug with right-shifting small ints by large amounts.
...
Undefined behavior in C, needs explicit check.
2014-11-02 02:41:30 +02:00
Damien George
c7da7838ba
tests: Add heapalloc.py.exp, since CPython can't generate it.
2014-10-31 22:09:40 +00:00
Damien George
109c1de015
py: Make gc.enable/disable just control auto-GC; alloc is still allowed.
...
gc.enable/disable are now the same as CPython: they just control whether
automatic garbage collection is enabled or not. If disabled, you can
still allocate heap memory, and initiate a manual collection.
2014-10-31 21:30:46 +00:00
Damien George
1559a97810
py: Add builtin round function.
...
Addresses issue #934 .
2014-10-31 11:28:50 +00:00
Damien George
efc49c5591
stmhal: Improve CAN print function.
2014-10-30 23:16:05 +00:00
Henrik Sölver
6a15ac80dc
tests: Added and adapted CAN tests for extended messages
2014-10-30 23:16:01 +00:00
Paul Sokolovsky
e62a0fe367
objstr: Allow to convert any buffer proto object to str.
...
Original motivation is to support converting bytearrays, but easier to just
support buffer protocol at all.
2014-10-31 00:03:53 +02:00
Paul Sokolovsky
66d08eb4fe
moductypes: Add test for accessing UINT8 array.
2014-10-30 03:50:37 +02:00
Paul Sokolovsky
2559e13957
moductypes: Make sure we can apply .sizeof() to all aggregate types.
...
Before, sizeof() could be applied to a structure field only if that field
was itself a structure. Now it can be applied to PTR and ARRAY fields too.
It's not possible to apply it to scalar fields though, because as soon as
scalar field (int or float) is dereferenced, its value is converted into
Python int/float value, and all original type info is lost. Moreover, we
allow sizeof of type definitions too, and there int is used to represent
(scalar) types. So, we have ambiguity what int may be - either dereferenced
scalar structure field, or encoded scalar type. So, rather throw an error
if user tries to apply sizeof() to int.
2014-10-30 03:50:23 +02:00
Damien George
b2f19b8d34
tests: Get builtin_compile to skin properly on pyboard.
2014-10-26 15:38:28 +00:00
Damien George
480a7ce58f
stmhal: Change SPI phase spec to 0,1 to match standard conventions.
...
Was 1 or 2, now 0 or 1 (respectively). 0 means sample MISO on first
edge, 1 means sample on second edge.
Addresses issue #936 .
2014-10-26 13:54:31 +00:00
Damien George
de3c806965
py: Fix memoryview referencing so it retains ptr to original buffer.
...
This way, if original parent object is GC'd, the memoryview still points
to the underlying buffer data so that buffer is not GC'd.
2014-10-26 13:20:50 +00:00
Damien George
627852019b
tests: Add test for compile builtin.
2014-10-25 22:07:25 +01:00
Paul Sokolovsky
e2f8d98525
stream: Add optional 2nd "length" arg to .readinto() - extension to CPython.
...
While extension to file.readinto() definition of CPython, the additional arg
is similar to what in CPython available in socket.recv_into().
2014-10-23 21:43:59 +03:00
Damien George
dd4f4530ab
py: Add builtin memoryview object (mostly using array code).
2014-10-23 13:34:35 +01:00
Damien George
f5d69794a8
extmod: Add uheapq module.
2014-10-22 23:20:15 +01:00
Damien George
e72be1b999
py: Fix smallint modulo with negative arguments.
...
Addresses issue #927 .
2014-10-22 23:05:50 +01:00
Damien George
e7a478204a
py: Remove unused and unneeded SystemError exception.
...
It's purpose is for internal errors that are not catastrophic (ie not as
bad as RuntimeError). Since we don't use it, we don't need it.
2014-10-22 19:42:55 +01:00
Damien George
481d714bd5
stmhal: Overhaul UART class to use read/write, and improve it.
...
UART object now uses a stream-like interface: read, readall, readline,
readinto, readchar, write, writechar.
Timeouts are configured when the UART object is initialised, using
timeout and timeout_char keyword args.
The object includes optional read buffering, using interrupts. You can set
the buffer size dynamically using read_buf_len keyword arg. A size of 0
disables buffering.
2014-10-21 22:15:20 +01:00
stijn
a3efe04dce
Use mode/encoding kwargs in io and unicode tests
...
mode argument is used to assert it works
encoding argument is used to make sure CPython uses the correct encoding
as it does not automatically use utf-8
2014-10-21 22:10:38 +03:00
Damien George
21ca2d76a2
py: Partially fix viper multi-comparison; add test for it.
2014-10-19 19:00:51 +01:00
Paul Sokolovsky
1a55b6a787
unix, stmhal: Implement file.readinto() method.
...
Also, usocket.readinto(). Known issue is that .readinto() should be available
only for binary files, but micropython uses single method table for both
binary and text files.
2014-10-18 22:44:07 +03:00
Paul Sokolovsky
297d8469b8
modure: Update to re1.5 v0.6.1, fixed and extended character class support.
2014-10-17 22:25:18 +03:00
Damien George
391db8669b
py: Add more compiler optimisations for constant if/while conditions.
2014-10-17 17:57:33 +00:00
Damien George
9870fdd4b0
tests: Add test for nested while with exc and break.
2014-10-17 17:28:25 +00:00
Paul Sokolovsky
067ae1269d
objclosure: Fix printing of generator closures.
...
The code previously assumed that only functions can be closed over.
2014-10-16 00:14:01 +03:00
Paul Sokolovsky
95908b0f50
modure: Update to re1.5 v0.6, support for char sets/classes ([a-c]).
2014-10-15 04:44:07 +03:00
Damien George
29f5682621
Merge pull request #904 from pfalcon/moduzlib
...
Module "uzlib" - based on similarly named library
2014-10-12 23:25:24 +01:00
Paul Sokolovsky
34162872b1
moduzlib: Integrate into the system.
2014-10-13 00:07:44 +03:00
Damien George
91cfd414c0
py: Implement native load for viper.
...
Viper can now do: ptr8(buf)[0], which loads a byte from a buffer using
machine instructions.
2014-10-12 16:59:29 +01:00
Damien George
1ef2348df0
py: Implement and,or,xor native ops for viper.
2014-10-12 14:21:06 +01:00
Paul Sokolovsky
f7bcce0552
modure: Basic tests.
2014-10-11 14:36:33 +03:00
Paul Sokolovsky
5dc8f9b28a
tests: Skip ffi_float.py if module ffi is not available.
2014-10-06 22:37:40 +03:00
Paul Sokolovsky
9aeec0e3a3
tests: Add missing "import sys".
2014-10-06 22:30:46 +03:00
Damien George
f53c343363
tests: Force skip of LE test on non-LE arch; improve run-tests-exp.sh.
2014-10-06 17:35:46 +00:00
Damien George
9c6f7378f7
tests: Make run-tests-exp.sh skip tests that fail due to invalid decorator.
...
Should address issue #856 .
2014-10-06 17:06:49 +00:00
Damien George
5a04e2cca8
tests: Add check for micropython.native and then skip relevant tests.
...
If micropython.native decorator doesn't compile, then we skill all
native/viper tests.
This patch also re-enables the ujson_loads test on NT.
Addresses issue #861 , and partially addresses issue #856 .
2014-10-05 22:27:12 +01:00
Damien George
a91ac2011f
py: Make compiler return a proper exception on SyntaxError.
2014-10-05 19:01:34 +01:00