Paul Sokolovsky
b4acd028b6
tests: Fix import.
2014-05-11 03:40:32 +03:00
Paul Sokolovsky
ea9708092e
objtuple: Go out of the way to support comparison of subclasses.
...
Two things are handled here: allow to compare native subtypes of tuple,
e.g. namedtuple (TODO: should compare type too, currently compared
duck-typedly by content). Secondly, allow user sunclasses of tuples
(and its subtypes) be compared either. "Magic" I did previously in
objtype.c covers only one argument (lhs is many), so we're in trouble
when lhs is native type - there's no other option besides handling
rhs in special manner. Fortunately, this patch outlines approach with
fast path for native types.
2014-05-11 03:33:19 +03:00
Paul Sokolovsky
9511f60f01
py: Don't try to "bind" types store as attributes of objects.
...
This was hit when trying to make urlparse.py from stdlib run. Took
quite some time to debug.
TODO: Reconsile bound method creation process better, maybe callable is
to generic type to bind at all?
2014-05-11 03:33:19 +03:00
Paul Sokolovsky
69f3eb2c96
objstr: Make .[r]partition() work with bytes.
2014-05-11 03:33:19 +03:00
Paul Sokolovsky
285683d203
objboundmeth: If detailed reporting enabled, print object content.
...
Similar to closure and cell.
2014-05-11 02:27:42 +03:00
Paul Sokolovsky
7aca1cae34
py: Start making good use of mp_const_obj_t.
2014-05-11 02:26:42 +03:00
Paul Sokolovsky
3f8d34ca83
objlist: Support list slice deletion.
2014-05-10 23:03:30 +03:00
Paul Sokolovsky
94d8246272
objlist: Implement non-growing slice assignment.
...
Slice value to assign can be only a list so far too.
2014-05-10 22:24:31 +03:00
Paul Sokolovsky
d915a52eb6
py: Fix prefix on few sequence helpers, was incorrectly "mp_".
2014-05-10 21:36:33 +03:00
Paul Sokolovsky
aa4d19a05c
objtype: Comments for duplicating code in runtime.c.
2014-05-10 21:26:08 +03:00
Paul Sokolovsky
1a7403bb74
objtype: Implement ->getiter() method for instances.
...
Includes support for native bases.
2014-05-10 21:26:08 +03:00
Paul Sokolovsky
0bc15941c2
py: Make mp_obj_print() handle null object w/o segfault if debug build.
...
Happens regularly when used for debugging.
2014-05-10 21:26:07 +03:00
Paul Sokolovsky
7067d69bcc
objnamedtuple: Support iteration.
2014-05-10 21:26:07 +03:00
Damien George
3793830ed9
tools: Move gendoc.py to tools, and make it a little more generic.
2014-05-10 19:12:47 +01:00
Damien George
09bbe7215a
stmhal: Fix USB CDC not flushing packets when an exact multiple of 64.
...
Need to send a zero-sized packet after sending an exact multiple of 64
bytes (not just after sending 64 bytes exactly).
Addresses issue #494 , part 2.
2014-05-10 18:56:16 +01:00
Damien George
0fb80c303a
py: Compress a little the bytecode emitter structure.
2014-05-10 18:16:21 +01:00
Damien George
9597771fe4
py, emitters: Fix dummy_data size for bytecode and thumb.
...
Thumb uses a bit less RAM, bytecode uses a tiny bit more, to avoid
overflow of the dummy buffer in certain cases.
Addresses issue #599 .
2014-05-10 18:07:08 +01:00
Damien George
7db57bf6b2
Merge branch 'master' of github.com:micropython/micropython
2014-05-10 17:50:05 +01:00
Paul Sokolovsky
6913521911
objstr: Implement .lower() and .upper().
2014-05-10 19:49:07 +03:00
Damien George
b0edec61ac
stmhal: Improve handling of out-of-memory in REPL.
...
Addresses issue #558 , but it's likely that other out-of-memory errors
could crash the pyboard. Reason is that qstrs use m_new and can raise
an exception within the parser.
2014-05-10 17:48:46 +01:00
Damien George
e1199ecf10
py, lexer: Add allocation policy config; return NULL if can't allocate.
2014-05-10 17:48:01 +01:00
Damien George
1b82e9af5c
py: Improve handling of memory error in parser.
...
Parser shouldn't raise exceptions, so needs to check when memory
allocation fails. This patch does that for the initial set up of the
parser state.
Also, we now put the parser object on the stack. It's small enough to
go there instead of on the heap.
This partially addresses issue #558 .
2014-05-10 17:36:41 +01:00
Paul Sokolovsky
ad6178bb08
builtinimport: Fix broken namespace imports due to dup vstr_cut_tail_bytes().
2014-05-10 19:00:03 +03:00
Paul Sokolovsky
f9589d2f23
builtinimport: Fix comment orphaned by one of previous commits.
2014-05-10 18:46:02 +03:00
Paul Sokolovsky
deaeaac469
modsys: Enable sys.exit() per port after all.
2014-05-10 17:26:47 +03:00
Paul Sokolovsky
37b0f33545
objset: Add frozenset tests, skippable if frozenset not available.
2014-05-10 16:56:21 +03:00
Paul Sokolovsky
43d4a6fa31
run-tests: Add support for skipping tests.
...
MicrpPython test should print single "SKIP" line for test to be skipped.
2014-05-10 16:56:21 +03:00
Paul Sokolovsky
0f14fdea0c
stmhal: Implement draft version of sys.exit().
2014-05-10 16:56:21 +03:00
Paul Sokolovsky
d99e9083cb
modsys, unix: Add sys.exit(), should be implemented by a port.
2014-05-10 16:56:21 +03:00
Paul Sokolovsky
d80e2476c7
py: Disable frozenset by default, enable on unix.
...
Takes 416 text bytes on x86.
2014-05-10 16:56:20 +03:00
Paul Sokolovsky
b181b581aa
objset: Give up and implement frozenset.
...
Tired of patching CPython stdlib for it.
2014-05-10 16:56:20 +03:00
Paul Sokolovsky
d86020ac4f
objtype: Don't treat inheritance from "object" as from native type.
...
"object" type in MicroPython currently doesn't implement any methods, and
hopefully, we'll try to stay like that for as long as possible. Even if we
have to add something eventually, look up from there might be handled in
adhoc manner, as last resort (that's not compliant with Python3 MRO, but
we're already non-compliant). Hence: 1) no need to spend type trying to
lookup anything in object; 2) no need to allocate subobject when explicitly
inheriting from object; 3) and having multiple bases inheriting from object
is not a case of incompatible multiple inheritance.
2014-05-10 16:56:20 +03:00
Damien George
d0a5bf34f7
py: Tidy up returning NULL which should be MP_OBJ_NOT_SUPPORTED.
2014-05-10 13:55:11 +01:00
Damien George
2bb179e124
bare-arm: Change output file from flash.elf to firmware.elf.
2014-05-10 13:45:47 +01:00
Damien George
ccc85ea0da
py: Combine native emitters to 1 glue function; distinguish viper.
...
This patch simplifies the glue between native emitter and runtime,
and handles viper code like inline assember: return values are
converted to Python objects.
Fixes issue #531 .
2014-05-10 13:40:46 +01:00
Damien George
04b7cc4df0
stmhal: Fix setting of RTC: was BCD now BIN encoded.
...
Addresses issue #592 .
2014-05-10 11:56:58 +01:00
Damien George
c17fd70de9
stm: Reorder mpconfig.h header inclusion to get stm building.
2014-05-10 10:38:38 +01:00
Damien George
3417bc2f25
py: Rename byte_code to bytecode everywhere.
...
bytecode is the more widely used. See issue #590 .
2014-05-10 10:36:38 +01:00
Paul Sokolovsky
6e8085b425
py: Fix base "detection" for int('0<hexdigit>', 16).
2014-05-10 04:45:15 +03:00
Paul Sokolovsky
7b0f9a7d9b
bytes: Implement comparison and other binary operations.
...
Should support everything supported by strings.
2014-05-10 04:45:02 +03:00
Paul Sokolovsky
070c78af5d
runtime0.h: Group binary ops by fives.
...
So one has some chance to convert numeric op code into symbol.
2014-05-10 04:44:55 +03:00
Paul Sokolovsky
affa870cc2
Merge pull request #575 from stinos/windows-modtime
...
Add modtime implementation for mingw
2014-05-09 22:09:10 +03:00
stijn
5ed284a15e
windows: Add modtime implementation
2014-05-09 13:58:15 +02:00
Damien George
d25cba4f64
Merge branch 'pfalcon-README-features-overview'
2014-05-09 12:01:15 +01:00
Damien George
65114ca015
README: Add articles, and update doc for deploying firmware.
2014-05-09 12:00:23 +01:00
Paul Sokolovsky
ad79ecdf96
README: Add short overview of Python features supported.
...
Also, "upgrade" project to "early beta", and elaborate pyboard description.
2014-05-09 04:15:24 +03:00
Damien George
8c1c7488b2
Add gc.enable, gc.disable; remove pyb.gc.
2014-05-08 23:04:49 +01:00
Damien George
d6cbbc51ab
stmhal: Add time.time() and time.localtime().
...
time.time: returns seconds since 1/1/2000, as an integer.
time.localtime: Returns 8-tuple: (year, month, date, hour, minute,
second, weekday, yearday).
2014-05-08 22:25:49 +01:00
Paul Sokolovsky
62b5f42d81
Merge pull request #568 from stinos/windows-msvc-port
...
Windows MS Visual C port
2014-05-09 00:03:42 +03:00
Damien George
ffae48d750
py, compiler: Add basic support for A=const(123).
...
You can now do:
X = const(123)
Y = const(456 + X)
and the compiler will replace X and Y with their values.
See discussion in issue #266 and issue #573 .
2014-05-08 15:58:39 +00:00