Paul Sokolovsky
513e6567b1
Add testcase for sequence unpacking.
11 years ago
Damien George
cbddb279bb
py: Implement break/continue from an exception with finally.
Still todo: break/continue from within the finally block itself.
11 years ago
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.
11 years ago
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.
11 years ago
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).
11 years ago
Paul Sokolovsky
027594e1a7
Typo fixes in comments.
11 years ago
Paul Sokolovsky
c92a56dc93
Add testcase with exception handler spread across functions.
11 years ago
xbe
480c15afb5
Implement str.replace and add tests for it.
11 years ago
xbe
65365778fd
Add tests for str.strip
11 years ago
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.
11 years ago
Damien George
09a0c64bce
py: Improve __bool__ and __len__ dispatch; add slots for them.
11 years ago
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.
11 years ago
Damien George
4a74d31e70
run-tests can handle segfault.
11 years ago
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.
11 years ago
Markus Siemens
19ccc6bdc7
Added Windows port (see #233 )
11 years ago
Paul Sokolovsky
1801421f6d
bytearray: Print objects properly.
11 years ago
Paul Sokolovsky
8e991e0680
Add basic array.array test.
11 years ago
Damien George
4e8dc8c41b
py: Add unary op not for NoneType, bool, tuple, list, dict; fix for int.
11 years ago
Paul Sokolovsky
9b00dad7bb
long int: Implement more operations.
11 years ago
Paul Sokolovsky
14d28be344
gen.send(): Throw StopIteration. Also, explicitly shutdown finished gen.
Otherwise, some generator statements still may be spuriously executed on
subsequent calls to next()/send().
11 years ago
Paul Sokolovsky
bf38e2a03a
Implement send() method for generators.
11 years ago
Damien George
7c9c667633
py: Implement iterator support for object that has __getitem__.
Addresses Issue #203 .
11 years ago
Paul Sokolovsky
91fb1c9b13
Add basic implementation of bytes type, piggybacking on str.
This reuses as much str implementation as possible, from this we
can make them more separate as needed.
11 years ago
Paul Sokolovsky
c3e72a8cc8
mp_obj_is_callable(): Only object types can be callable.
Fixes segfault on callable("string").
11 years ago
Paul Sokolovsky
1eacefe5bc
Implement simplest case of str.startswith().
11 years ago
Paul Sokolovsky
0b7184dcb8
Implement octal and hex escapes in strings.
11 years ago
Damien George
600ae734cf
py: Implement break and continue byte codes, and add tests.
Also fixes a bug in the for-in-range optimiser.
I hope to remove break and continue byte codes in the future and just
use jump (if possible).
11 years ago
Paul Sokolovsky
d30e019459
Add bytearray basic tests.
11 years ago
Paul Sokolovsky
7280f79088
run-tests: Allow to run tests selectively via command line.
11 years ago
Paul Sokolovsky
4c316552c1
Implement str.split(None).
Note that splitting by explicit string is not implemented so far.
11 years ago
Paul Sokolovsky
7380a83780
str: Implement proper string (instead of byte string) indexing.
Also, support negative indexes.
11 years ago
Paul Sokolovsky
545591a696
Implement string multiplication.
11 years ago
Paul Sokolovsky
decd597273
unix io.FileIO: Add iteration support.
A file cannot be iterated concurrently, so we make io.FileIO its own
iterator.
11 years ago
Damien George
7d08935458
Rename unix binary to 'micropython'.
11 years ago
Paul Sokolovsky
fe2690da0a
unix: Implement sys.argv.
11 years ago
Paul Sokolovsky
db796ef84d
Add README for tests/.
11 years ago
Paul Sokolovsky
9954b4b99d
Add directory for I/O tests with basic test for file methods.
11 years ago
Paul Sokolovsky
8c3858b016
Move tests in basic/tests/ up one level preparating to multiple test dirs.
11 years ago
Damien George
ebde0b8a09
Tiny optimisation in objlist.c; a new test for inheritance.
11 years ago
Damien George
f49ba1bd9c
Improve method lookup in mp_obj_class_lookup.
Now searches both locals_dict and methods. Partly addresses Issue #145 .
11 years ago
Paul Sokolovsky
b31b5e0b5c
Add testcase for subclassing builtin type and calling native method (broken).
11 years ago
Damien George
1d6fc94c16
Implement framework for class-defined built-in operators.
Now working for class-defined methods: __getitem__, __setitem__,
__add__, __sub__. Easy to add others.
11 years ago
Paul Sokolovsky
10744dd816
Add empty (false) value testing for strings, tuples, lists, dicts.
11 years ago
Paul Sokolovsky
f2b796e7c7
str.format: Don't assume that '}' immediately follows '{', skip insides.
That at least makes stuff like "{:x}".format(1) to produce not completely
broken output.
11 years ago
Damien George
d02c6d8962
Implement eval.
11 years ago
Damien George
e2fb2baaa4
Implement repr.
11 years ago
xyb
3e4ed25138
add more tests and remove debug code
11 years ago
xyb
3270fb4be6
int() test passed
11 years ago
John R. Lenton
fca456bc3c
added filter()
11 years ago
John R. Lenton
39b174e00a
Added map
11 years ago