Commit Graph

693 Commits

Author SHA1 Message Date
Damien George
6bbbb1ab41 unix/modffi: Support passing float/double args. 2015-04-28 19:40:34 +01:00
Paul Sokolovsky
ae2c81ff38 vm: On exiting except block, clear sys.exc_info() value.
This doesn't handle case fo enclosed except blocks, but once again,
sys.exc_info() support is a workaround for software which uses it
instead of properly catching exceptions via variable in except clause.
2015-04-26 01:40:37 +03:00
Damien George
271d18eb08 py: Support conversion of bignum to bytes.
This gets int.to_bytes working for bignum, and also struct.pack with 'q'
and 'Q' args on 32-bit machines.

Addresses issue #1155.
2015-04-25 23:16:39 +01:00
Paul Sokolovsky
8b85d14b92 modsys: Add basic sys.exc_info() implementation.
The implementation is very basic and non-compliant and provided solely for
CPython compatibility. The function itself is bad Python2 heritage, its
usage is discouraged.
2015-04-25 03:49:23 +03:00
Damien George
8c1d23a0e2 py: Modify bytecode "with" behaviour so it doesn't use any heap.
Before this patch a "with" block needed to create a bound method object
on the heap for the __exit__ call.  Now it doesn't because we use
load_method instead of load_attr, and save the method+self on the stack.
2015-04-24 01:52:28 +01:00
Damien George
40d43ea88d tests: Add more tests for viper, including tests for ViperTypeError's. 2015-04-22 23:18:28 +01:00
Damien George
1f9e2188a6 tests: Add tests for attrtuple, and for more corner cases. 2015-04-22 16:52:03 +01:00
Damien George
956d765786 py: Fix printing of "inf" and "nan" floating point values. 2015-04-22 16:51:29 +01:00
=
5008972fef py/inlinethumb: Support for core floating point instructions.
Adds support for the following Thumb2 VFP instructions, via the option
MICROPY_EMIT_INLINE_THUMB_FLOAT:

vcmp
vsqrt
vneg
vcvt_f32_to_s32
vcvt_s32_to_f32
vmrs
vmov
vldr
vstr
vadd
vsub
vmul
vdiv
2015-04-19 15:47:05 +01:00
Damien George
d8cbbcaa9d py: Fix builtin ord so that it can handle bytes values >= 0x80.
Addresses issue #1188.
2015-04-19 12:26:46 +01:00
Henrik
e3cd154317 stmhal: Add support for sending and receiving CAN RTR messages. 2015-04-18 14:53:00 +01:00
Damien George
7d5e34287c stmhal: Allow sending CAN messages with timeout=0.
Thanks to Henrik Sölver for this patch.
2015-04-16 23:52:43 +01:00
Damien George
90aa7595b4 tests: Convert line endings in fun_name.py from CRLF to LF. 2015-04-16 22:09:17 +01:00
Damien George
044c473de2 py: Add %q format support to mp_[v]printf, and use it. 2015-04-16 14:30:16 +00:00
Paul Sokolovsky
56beb01724 objarray: Support assignment of bytes to bytearray slice. 2015-04-16 00:51:12 +03:00
Paul Sokolovsky
8b7faa31e1 objstr: split(None): Fix whitespace properly. 2015-04-12 00:17:57 +03:00
Damien George
7a6dbaa89b stmhal: Make LED object print LED(x) for consistency with constructor. 2015-04-11 21:50:53 +01:00
Damien George
9988618e0e py: Implement full func arg passing for native emitter.
This patch gets full function argument passing working with native
emitter.  Includes named args, keyword args, default args, var args
and var keyword args.  Fully Python compliant.

It reuses the bytecode mp_setup_code_state function to do all the hard
work.  This function is slightly adjusted to accommodate native calls,
and the native emitter is forced a bit to emit similar prelude and
code-info as bytecode.
2015-04-07 22:43:28 +01:00
Damien George
c9aa1883ed py: Simplify bytecode prelude when encoding closed over variables. 2015-04-07 00:08:17 +01:00
Damien George
78772ada0d py: Implement calling functions with *args in native emitter. 2015-04-06 22:48:21 +01:00
Damien George
e5c4362a98 tests: Add some more tests to improve code coverage of corner cases. 2015-04-05 00:03:43 +01:00
Damien George
97abe22963 tests: Add tests to exercise lexer; and some more complex number tests. 2015-04-04 23:16:22 +01:00
Damien George
9dd3640464 tests: Add missing tests for builtins, and many other things. 2015-04-04 22:05:30 +01:00
Paul Sokolovsky
620058cc57 tests: Add test for str.splitlines(). 2015-04-04 00:09:54 +03:00
Damien George
82f37bf0d1 tests: Add specific test for closures in native emitter. 2015-04-03 16:14:25 +01:00
Damien George
4cd9ced8dc py: Implement closures in native code generator.
Currently supports only x64 and Thumb2 archs.
2015-04-03 15:05:53 +01:00
Paul Sokolovsky
ad038ca101 tests/class_descriptor.py: Fix line-endings (were CRLF). 2015-03-28 01:07:00 +02:00
stijn
28fa84b445 py: Add optional support for descriptors' __get__ and __set__ methods.
Disabled by default.  Enabled on unix and windows ports.
2015-03-26 23:55:14 +00:00
Damien George
23d7fd526d tests: Skip some new tests when testing native emitter. 2015-03-25 23:33:48 +00:00
Damien George
214179b430 tests: Add tests for SyntaxError, TypeError, and other missing things.
This is intended to improve coverage of the test suite.
2015-03-25 23:10:09 +00:00
Damien George
db80b65402 tests: Make pyb/timer test check callback timing properly. 2015-03-20 23:50:33 +00:00
stijn
3cc17c69ff py: Allow retrieving a function's __name__.
Disabled by default.  Enabled on unix and stmhal ports.
2015-03-20 23:13:32 +00:00
Damien George
d478fc75b3 tests: Adjust expected output, since Travis can't do git describe. 2015-03-20 21:31:50 +00:00
Paul Sokolovsky
d48035b06b tests: Add basic test for OrderedDict.
Mostly to have coverage of newly added code in map.c.
2015-03-20 17:26:10 +00:00
Damien George
1004535237 tests: Make cmdline tests more stable by using regex for matching. 2015-03-20 17:25:25 +00:00
Damien George
f256cfef4f tests: Add some more tests for complex numbers and ure module. 2015-03-14 22:56:02 +00:00
Damien George
6837d46c1d py: Fix builtin abs so it works for bools and bignum. 2015-03-14 22:07:30 +00:00
Damien George
26a9975fba tests: Add some more tests for bytes, bignum, string and ujson. 2015-03-14 21:20:58 +00:00
Damien George
0683c1ceef tests: Don't try to verify amount of memory used in cmd_showbc test. 2015-03-14 17:38:41 +00:00
Damien George
703c009681 tests: Add cmdline test to test showbc code. 2015-03-14 14:06:20 +00:00
Damien George
ac4f6b804f stmhal: Fix adc.read_timed so buffer store respects element size.
Addresses issue #1154.
2015-03-13 22:11:50 +00:00
Damien George
143c34109c tests: Add ability to test uPy cmdline executable.
This allows to test options passed to cmdline executable, as well as the
behaviour of the REPL.
2015-03-13 10:58:34 +00:00
Damien George
af43565322 tests: Add tests for things that are not already tested.
The aim here is to improve coverage of the code.
2015-03-12 22:48:45 +00:00
Damien George
c832bde05f tests: Add zlib test for decompressing uncompressed data. 2015-03-12 00:17:04 +00:00
Peter D. Gray
b2a237d337 py: Add support for start/stop/step attributes of builtin range object. 2015-03-11 20:02:06 +00:00
Damien George
55278dcc76 tests: Add test for modure when regex has errors. 2015-03-10 17:47:43 +00:00
Damien George
6cb6947b99 extmod/ure: Correctly return None when a group has no match.
See issue #1122.
2015-03-04 13:51:32 +00:00
Damien George
72ddcfd9ff tests: Skip basics/boundmeth1.py for native emitter. 2015-03-03 18:06:45 +00:00
Damien George
086a7616dd tests: Add tests for boundmeth; and bignum cmp, unary, float, error. 2015-03-03 16:45:39 +00:00
stijn
25f1264699 tests: Skip special math fun tests when math module exists but not funs. 2015-03-03 14:36:59 +00:00