stijn
709955b601
py: Fix printing of complex number when imaginary part is nan
2015-05-13 23:10:15 +01:00
Damien George
f601390ef8
unix: Add some extra coverage tests for vstr and attrtuple.
2015-05-12 23:34:10 +01:00
Damien George
7bab32ef89
tests: Add further tests for class defining __hash__.
2015-05-12 23:08:18 +01:00
Damien George
c2a4e4effc
py: Convert hash API to use MP_UNARY_OP_HASH instead of ad-hoc function.
...
Hashing is now done using mp_unary_op function with MP_UNARY_OP_HASH as
the operator argument. Hashing for int, str and bytes still go via
fast-path in mp_unary_op since they are the most common objects which
need to be hashed.
This lead to quite a bit of code cleanup, and should be more efficient
if anything. It saves 176 bytes code space on Thumb2, and 360 bytes on
x86.
The only loss is that the error message "unhashable type" is now the
more generic "unsupported type for __hash__".
2015-05-12 22:46:02 +01:00
Paul Sokolovsky
6738c1dded
vm: Properly handle StopIteration raised in user instance iterator.
...
I.e. in bytecode Python functions.
2015-05-11 23:57:42 +01:00
blmorris
5df81de7af
sthmal/rtc.c: Add calibration() method to get/set RTC fine-tuning value.
2015-05-11 23:48:39 +01:00
Paul Sokolovsky
4ed7b7f751
py: iternext() may not return MP_OBJ_NULL, only MP_OBJ_STOP_ITERATION.
...
Testing for incorrect value led to premature termination of generator
containing yield from for such iterator (e.g. "yield from [1, 2]").
2015-05-10 00:41:49 +03:00
Damien George
d792d9e49e
unix: Make extra-coverage function callable from Python scripts.
...
This allows the output of the extra-coverage tests to be checked using
the normal run-tests script.
2015-05-08 09:18:38 +01:00
Damien George
0589c19d52
tests: Add test for machine module (mem* functions).
2015-05-08 00:18:28 +01:00
Damien George
57ebe1b27d
unix-cpy: Fix adjustment of stack size when leaving exception handler.
...
Also remove __debug__ from one of the bytecode tests.
2015-05-06 16:46:21 +01:00
Damien George
9a42eb541e
py: Fix naming of function arguments when function is a closure.
...
Addresses issue #1226 .
2015-05-06 13:55:33 +01:00
Damien George
367d4d1098
tests: Fix cmd_showbc now that LOAD_CONST_ELLIPSIS bytecode is gone.
2015-05-05 23:58:52 +01:00
Paul Sokolovsky
37c6555b44
obj: Handle user instance hash based on Python adhoc rules.
...
User instances are hashable by default (using __hash__ inherited from
"object"). But if __eq__ is defined and __hash__ not defined in particular
class, instance is not hashable.
2015-05-05 22:48:19 +03:00
Paul Sokolovsky
3d3ef36e97
modstruct: Rename module to "ustruct", to allow full Python-level impl.
2015-05-04 16:53:52 +03:00
Damien George
47b9809d23
py: Check that arg to object.__new__ is a user-defined type.
...
Addresses issue #1203 .
2015-05-04 11:08:40 +01:00
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