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
Paul Sokolovsky
76d982ef34
type->print(): Distinguish str() and repr() variety by passing extra param.
11 years ago
John R. Lenton
9daa78943e
added enumerate()
11 years ago
Paul Sokolovsky
8bc96471f0
Implement "is" and "is not" operators.
So far, don't work for strings as expected.
11 years ago
Paul Sokolovsky
ddf2178d83
Refactor exception objects to have better impl of Python-side interface.
This implements internal args tuple of arguments, while still keeping
object useful for reporting C-side errors.
Further elaboration is needed.
11 years ago
xyb
c178ea471e
Implemented int(str) in UNIX
11 years ago
John R. Lenton
5c76839559
sorted
11 years ago
John R. Lenton
07205ec323
added zip()
11 years ago
John R. Lenton
7244a14439
oops, nasty off-by-one in set_copy
11 years ago
John R. Lenton
be790f94d5
Implemented set binary ops.
11 years ago