Paul Sokolovsky
d08fd68664
Add basic collections.namedtuple implementation.
2014-03-03 11:42:53 +08:00
Damien George
06201ff3d6
py: Implement bit-shift and not operations for mpz.
...
Implement not, shl and shr in mpz library. Add function to create mpzs
on the stack, used for memory efficiency when rhs is a small int.
Factor out code to parse base-prefix of number into a dedicated function.
2014-03-01 19:50:50 +00:00
Paul Sokolovsky
135002a086
Add basic super() test.
2014-02-22 20:25:05 +02:00
Paul Sokolovsky
56e5ef203b
parse: Refactor parse node encoding to support full range of small ints.
...
Based on suggestion by @dpgeorge at
https://github.com/micropython/micropython/pull/313
2014-02-22 16:39:45 +02:00
Paul Sokolovsky
fb7f94392d
import: Implement "from pkg.mod import sym" syntax properly.
...
http://docs.python.org/3.3/library/functions.html#__import__ :
"When the name variable is of the form package.module, normally, the
top-level package (the name up till the first dot) is returned, not
the module named by name. However, when a non-empty fromlist argument
is given, the module named by name is returned."
2014-02-20 00:37:12 +02:00
Paul Sokolovsky
ac2e28c654
Support passing positional args as keywords to bytecode functions.
...
For this, record argument names along with each bytecode function. The code
still includes extensive debug logging support so far.
2014-02-16 18:36:33 +02:00
Paul Sokolovsky
1b694c082e
Rename fun-kwargs.py -> fun-kwvarargs.py to free up slot for simple kw test.
2014-02-16 15:55:06 +02:00
Paul Sokolovsky
91ba7a54c5
builtinimport: Get the basic (and only basic) package imports work.
2014-02-16 02:55:46 +02:00
Damien George
e5d371b545
py: Pass keyword arguments to byte code.
2014-02-16 00:17:42 +00:00
Damien George
2e482cdb7b
py: Implement *vargs support.
...
Addresses issue #295 .
2014-02-16 00:01:29 +00:00
Damien George
c8f78bc280
py: VM never throws an exception, instead returns a status and value.
...
Addresses issue #290 , and hopefully sets up things to allow generators
throwing exceptions, etc.
2014-02-15 22:55:00 +00:00
Paul Sokolovsky
8ac72b9d00
Add testcase for failing namespace switch throwing exception from a module.
...
Issue #290 . This currently fails, to draw attention to the issue.
2014-02-15 12:44:29 +02:00
Paul Sokolovsky
e7299b5296
Add testcase for "from module import *".
2014-02-14 00:30:36 +02:00
Paul Sokolovsky
b2e8c52298
Add testcase for "from module import sym".
2014-02-14 00:30:36 +02:00
Paul Sokolovsky
2aa217b974
Implement full arg handling for exec().
2014-02-13 00:36:54 +02:00
Paul Sokolovsky
8d90a382cf
basics/enumerate.py: Don't turn enumerate test into heap test.
...
With range(10000), doesn't fit into 128K heap.
2014-02-11 15:34:32 +02:00
Damien George
e8d2c3cf6c
Merge pull request #267 from pfalcon/func-ret-ann
...
Clean up handling of function return type annotation.
2014-02-10 21:59:11 +00:00
Paul Sokolovsky
ac0134d427
Factor out mp_seq_count_obj() and implement tuple.count().
2014-02-10 07:13:32 +02:00
Paul Sokolovsky
624eff6a8a
Implement tuple.index().
2014-02-10 07:13:32 +02:00
Paul Sokolovsky
2f0b026a44
Clean up handling of function return type annotation.
2014-02-10 02:04:26 +02:00
Paul Sokolovsky
f7c2410e65
Implement tuple multiplication.
2014-02-08 23:19:48 +02:00
Paul Sokolovsky
ee4aaf7cdd
Implement tuple addition.
2014-02-08 23:17:51 +02:00
Paul Sokolovsky
e827e98a6f
Implement tuple comparison.
2014-02-08 22:56:36 +02:00
Paul Sokolovsky
9fce77c993
Add more finally + break/continue testcases.
2014-02-06 03:27:39 +02:00
Paul Sokolovsky
3c95ba7e4e
Add additional testcase for finally/return.
2014-02-06 03:20:56 +02:00
Paul Sokolovsky
00c0b8a989
Fix unstable case in builtin_id.py test.
2014-02-04 00:50:22 +02:00
Damien George
93d004f4b0
Merge branch 'xbe-master'
2014-02-02 13:38:41 +00:00
Damien George
330cf6d04a
Change id to return signed integer.
2014-02-02 13:38:21 +00:00
Paul Sokolovsky
87e85b7dc7
Implement str/bytes rich comparisons.
2014-02-02 08:58:16 +02:00
xbe
0ebf8534ab
Implement and add tests for the id() builtin function.
2014-02-01 19:00:41 -08:00
Paul Sokolovsky
9ed5435061
Implement slicing for tuples.
2014-02-02 03:42:07 +02:00
Paul Sokolovsky
13cfabd1b2
Implement slicing for lists.
2014-02-02 03:32:55 +02:00
Paul Sokolovsky
513e6567b1
Add testcase for sequence unpacking.
2014-02-02 01:34:11 +02:00
Damien George
cbddb279bb
py: Implement break/continue from an exception with finally.
...
Still todo: break/continue from within the finally block itself.
2014-02-01 20:08:18 +00:00
Damien George
87413a4d0c
Merge branch 'fun-defargs' of github.com:pfalcon/micropython into pfalcon-fun-defargs
2014-02-01 17:51:47 +00:00
Paul Sokolovsky
90750029df
Implement default function arguments (for Python functions).
...
TODO: Decide if we really need separate bytecode for creating functions
with default arguments - we would need same for closures, then there're
keywords arguments too. Having all combinations is a small exponential
explosion, likely we need just 2 cases - simplest (no defaults, no kw),
and full - defaults & kw.
2014-02-01 15:38:22 +02:00
Paul Sokolovsky
6472dea146
Add exception stack unwind support for RETURN_VALUE.
...
This properly implements return from try/finally block(s).
TODO: Consider if we need to do any value stack unwinding for RETURN_VALUE
case. Intuitively, this is "success" return, so value stack should be in
good shape, and unwinding shouldn't be required.
2014-02-01 15:23:03 +02:00
Damien George
532f2c30f6
Merge pull request #246 from pfalcon/exc_stack_entry
...
vm: Introduce structure for exception stack entry, record entry type.
2014-01-31 15:51:20 -08:00
Damien George
1aa1c511dd
Merge branch 'master' of github.com:xbe/micropython into xbe-master
2014-01-31 23:29:57 +00:00
Paul Sokolovsky
c9887cbbe2
Add basic try-finally testcase.
...
It's mildly suprising these work without further changes to exception
handling code (the only change required was to handle SETUP_FINALLY).
2014-01-31 21:33:07 +02:00
Paul Sokolovsky
027594e1a7
Typo fixes in comments.
2014-01-31 19:47:23 +02:00
Paul Sokolovsky
c92a56dc93
Add testcase with exception handler spread across functions.
2014-01-31 17:06:15 +02:00
xbe
480c15afb5
Implement str.replace and add tests for it.
2014-01-30 22:17:30 -08:00
xbe
65365778fd
Add tests for str.strip
2014-01-30 22:16:47 -08:00
Paul Sokolovsky
382e8eeea2
vm: Add basic implementation of END_FINALLY opcode.
...
Allows to have nested try blocks with except filters.
TODO: Don't add END_FINALLY's exception re-raise points to traceback.
2014-01-30 13:49:18 +02:00
Damien George
09a0c64bce
py: Improve __bool__ and __len__ dispatch; add slots for them.
2014-01-30 10:05:33 +00:00
Paul Sokolovsky
c1d9bbc345
Implement __bool__ and __len__ via unary_op virtual method for all types.
...
__bool__() and __len__() are just the same as __neg__() or __invert__(),
and require efficient dispatching implementation (not requiring search/lookup).
type->unary_op() is just the right choice for this short of adding
standalone virtual method(s) to already big mp_obj_type_t structure.
2014-01-30 04:37:19 +02:00
Damien George
b40892d266
Rename array test to array1 so it doesn't clash with array module.
...
On my machine, 'import array' in CPython tries to load the array test.
2014-01-28 23:12:35 +00:00
Paul Sokolovsky
1801421f6d
bytearray: Print objects properly.
2014-01-28 03:40:48 +02:00
Paul Sokolovsky
8e991e0680
Add basic array.array test.
2014-01-28 03:19:32 +02:00