Damien George
897fe0c0d0
py: Add builtin functions bin and oct, and some tests for them.
2014-04-15 22:03:55 +01:00
Damien George
256b319d56
tests: Disable memoryerror.py test, since it fails on travis.
...
Would be good to test this, but need to find a way to optionally not
running it when on travis.
2014-04-15 12:30:30 +01:00
Damien George
48aaa27c6a
travis: Diff output, hopefully this works.
2014-04-15 12:20:22 +01:00
Damien George
e8ecca21ff
travis: More tests output debugging.
2014-04-15 11:56:57 +01:00
Damien George
35443610b1
travis: More tests debugging.
2014-04-15 11:38:30 +01:00
Damien George
45b4cc77dd
travis: Debugging failing tests.
2014-04-15 11:25:36 +01:00
Paul Sokolovsky
75ffcaeace
py: Implement __delitem__ method for classes.
2014-04-15 01:30:25 +03:00
Damien George
e2a48b66c2
tests: Add property test.
2014-04-13 19:00:27 +01:00
Damien George
4417478d0f
tests: Make tests pass on pyboard.
2014-04-13 17:46:30 +01:00
Damien George
b636d024d2
Make pyboard.py have its own exception; update run-tests for pyboard.
2014-04-13 13:48:33 +01:00
Damien George
f95c68e536
Merge pull request #473 from pfalcon/list-extend-iter
...
objlist: Make .extend accept arbitrary iterable.
2014-04-13 12:46:34 +01:00
Paul Sokolovsky
48fdaad824
py: Rename collections module to _collections.
...
We're not going to implement all the plethora of types in there in C.
Funnily, CPython implements defaultdict in C, and namedtuple in Python.
2014-04-13 10:24:00 +03:00
Paul Sokolovsky
aa6666c45e
objlist: Make .extend accept arbitrary iterable.
2014-04-13 03:21:31 +03:00
Damien George
6ce4277551
py: Make all LOAD_FAST ops check for unbound local.
...
This is necessary to catch all cases where locals are referenced before
assignment. We still keep the _0, _1, _2 versions of LOAD_FAST to help
reduced the byte code size in RAM.
Addresses issue #457 .
2014-04-12 18:20:40 +01:00
Damien George
c2803db010
tests: Add some bytecode tests.
2014-04-12 18:00:32 +01:00
Paul Sokolovsky
a5afc9009f
builtinimport: Implement relative imports.
2014-04-12 18:25:17 +03:00
Paul Sokolovsky
2ff3d9d0b2
builtinimport: Set __path__ attribute ASAP as it's clear we have a package.
...
This helps with handling "recursive" imports in sane manner, for example
when foo/__init__.py has something like "from foo import submod".
2014-04-12 02:55:18 +03:00
Damien George
8f19317540
py: Remove useless implementations of NOT_EQUAL in binary_op's.
...
I'm pretty sure these are never reached, since NOT_EQUAL is always
converted into EQUAL in mp_binary_op. No one should call
type.binary_op directly, they should always go through mp_binary_op
(or mp_obj_is_equal).
2014-04-12 00:20:39 +01:00
Paul Sokolovsky
af620abcb5
py: Implement "from pkg import mod" variant of import.
2014-04-12 00:39:55 +03:00
Damien George
0e3329a6b8
py, compiler: Allow lambda's to yield.
2014-04-11 13:10:21 +00:00
Damien George
0288cf020e
py: Implement compiling of *-expr within parenthesis.
2014-04-11 11:53:00 +00:00
Damien George
686afc5c0a
py: Check that sequence has 2 elements for dict iterable constructor.
2014-04-11 09:13:30 +01:00
Paul Sokolovsky
be019ce063
objdict: Implement construction from iterable of pairs.
...
Pairs are limited to tuples so far.
2014-04-11 07:01:15 +03:00
Paul Sokolovsky
12a04392b9
objdict: Implement __getitem__ method.
2014-04-11 05:24:44 +03:00
Paul Sokolovsky
0c43cf9154
modstruct: Basic implementation of native struct alignment and types.
2014-04-11 03:59:16 +03:00
Paul Sokolovsky
6582d64d01
modstruct: Refactor to support both LE and BE packed structs.
2014-04-11 03:58:49 +03:00
Damien George
f31b6ff334
tests: Add test for multi-comparison.
2014-04-10 17:29:51 +00:00
Paul Sokolovsky
978607aeff
objfun: Fix default arguments filling loop, was broken in presense of kwargs.
2014-04-10 05:39:38 +03:00
Paul Sokolovsky
e9db840480
py: Start implementing "struct" module.
...
Only calcsize() and unpack() functions provided so far, for little-endian
byte order. Format strings don't support repition spec (like "2b3i").
Unfortunately, dealing with all the various binary type sizes and alignments
will lead to quite a bloated "binary" helper functions - if optimizing for
speed. Need to think if using dynamic parametrized algos makes more sense.
2014-04-10 03:58:03 +03:00
Damien George
038fd52faa
Merge branch 'str-index' of github.com:xbe/micropython into xbe-str-index
2014-04-09 20:44:37 +01:00
Damien George
a157e4caba
py: str.join can now take arbitrary iterable as argument.
2014-04-09 19:17:53 +01:00
Damien George
13d6739cc7
py: Generators can have their locals closed over.
2014-04-09 19:01:45 +01:00
Damien George
2bf7c09222
py: Properly implement deletion of locals and derefs, and detect errors.
...
Needed to reinstate 2 delete opcodes, to specifically check that a local
is not deleted twice.
2014-04-09 15:26:46 +01:00
Paul Sokolovsky
a985b4593d
objint: Implement int.from_bytes() class method and .to_bytes() method.
...
These two are apprerently the most concise and efficient way to convert
int to/from bytes in Python. The alternatives are struct and array modules,
but methods using them are more verbose in Python code and less efficient
in memory/cycles.
2014-04-09 01:07:37 +03:00
Damien George
2b0091983f
tests: Oops: fix del-attr.
2014-04-08 23:02:24 +01:00
Damien George
f4c9b33abf
py: Remove DELETE_SUBSCR opcode, combine with STORE_SUBSCR.
...
This makes the runtime and object APIs more consistent. mp_store_subscr
functionality now moved into objects (ie list and dict store_item).
2014-04-08 21:32:29 +01:00
Paul Sokolovsky
4dcb605ac4
py: Make bytearray a proper type.
2014-04-08 22:11:40 +03:00
xbe
3d9a39e211
py: Implement str.[r]index() and add tests for them.
2014-04-08 11:51:41 -07:00
Damien George
134c10e776
Merge branch 'master' of github.com:micropython/micropython
2014-04-08 18:29:50 +01:00
Damien George
495d781a36
py: implement UNPACK_EX byte code (for: a, *b, c = d)
2014-04-08 17:51:47 +01:00
Paul Sokolovsky
b9cf3d3730
bytearray: Support bytearray(int) constructor.
...
To create bytearray of given length.
2014-04-08 19:08:34 +03:00
Andrew Scheller
12968fb6b2
Display \r and \t escape codes in string repr
2014-04-08 02:42:50 +01:00
Dave Hylands
c4029e5079
Add string formatting support for longlong and mpz.
2014-04-07 11:38:45 -07:00
Damien George
1422865c99
Merge pull request #445 from lurch/test-sorted-sets
...
Modify set tests to print sorted sets directly
2014-04-07 13:15:33 +01:00
Andrew Scheller
1ff6011abc
Modify set tests to print sorted sets directly
...
instead of creating temporary lists and sorting those in-place
2014-04-07 05:00:03 +01:00
Andrew Scheller
a1a9ab2b2c
Add tests for sorted() function
...
and check that sorted(list) produces same output as list.sort()
2014-04-07 04:41:54 +01:00
Paul Sokolovsky
4d2238d2ce
tests: Fix more tests which depend on order of elements in set.
2014-04-07 03:08:46 +03:00
Paul Sokolovsky
bd6f3d31d2
tests: Fix few tests which depend on order of elements in set.
2014-04-07 02:54:16 +03:00
Damien George
07e24a6294
tests: Fix tests with sets to print sorted set.
2014-04-07 00:42:09 +01:00
Damien George
ff715429ea
py: Fix str.replace for case when arg 0 or 1 is empty string.
2014-04-07 00:39:13 +01:00