Damien George
256afcf9f6
Merge pull request #411 from dhylands/pfenv-64-bit
...
Fix INT_BUF_SIZE to work with 32-bit and 64-bit
2014-04-01 20:18:14 +01:00
Paul Sokolovsky
380cc53bd9
Merge pull request #408 from dhylands/str-quick-tests
...
Turn off full tests in string-format.py
2014-04-02 03:13:51 +08:00
Dave Hylands
1c6b4b2e24
Reduce stack usage of pfenv_print_strn
2014-04-01 11:59:31 -07:00
Dave Hylands
80359aa96e
Fix INT_BUF_SIZE to work with 32-bit and 64-bit
2014-04-01 11:03:44 -07:00
Dave Hylands
18d21d1abd
Fix pyb.Led(n) code to work properly.
2014-04-01 10:41:22 -07:00
Dave Hylands
7adc2e0431
Turn off full tests in string-format.py
...
Add some basic coverage tests
2014-04-01 08:10:02 -07:00
Paul Sokolovsky
51413c8cb6
tests: Add test for implicit float to int conversion (not allowed!)
2014-04-01 13:50:16 +03:00
Damien George
e09320adb5
py: Remove implicit conversion from int to float.
2014-04-01 10:56:07 +01:00
Damien George
46330bd9b5
Merge pull request #407 from dhylands/str-format
...
Enhance str.format support
2014-04-01 10:48:58 +01:00
Dave Hylands
baf6f14deb
Enhance str.format support
...
This adds support for almost everything (the comma isn't currently
supported).
The "unspecified" type with floats also doesn't behave exactly like
python.
Tested under unix with float and double
Spot tested on stmhal
2014-04-01 01:17:33 -07:00
Damien George
e44d26ae0c
py: Implement __getattr__.
...
It's not completely satisfactory, because a failed call to __getattr__
should not raise an exception.
__setattr__ could be implemented, but it would slow down all stores to a
user created object. Need to implement some caching system.
2014-03-31 22:57:56 +01:00
Paul Sokolovsky
4db727afea
objstr: Very basic implementation of % string formatting operator.
2014-03-31 21:20:52 +03:00
Paul Sokolovsky
6ce78c4fae
py: Wrap .__class__ handling in MICROPY_CPYTHON_COMPAT.
...
Because it's superfluos in the presence of type(), a remenant from Python's
"old classes".
2014-03-31 20:40:31 +03:00
Paul Sokolovsky
b509f73982
objtype: Wrap .__name__ handling in MICROPY_CPYTHON_COMPAT.
...
Because it's runtime reflection feature, not required for many apps.
Rant time:
Python could really use better str() vs repr() distinction, for example,
repr(type) could be "<class 'foo'>" (as it is now), and str(type) just
"foo". But alas, getting straight name requires adhoc attribute.
2014-03-31 20:40:31 +03:00
Damien George
a8dda295c4
Fix part->port in README.
2014-03-31 18:09:39 +01:00
Damien George
30a5f853dd
Merge pull request #404 from jonmills/patch-1
...
Update README.md
2014-03-31 18:09:14 +01:00
Damien George
18a6eb9e13
Merge branch 'master' of github.com:micropython/micropython
2014-03-31 18:03:52 +01:00
Damien George
3ff2d03891
py: Fix bug in optimised for .. range.
...
Don't store final, failing value to the loop variable. This fix also
makes for .. range a bit more efficient, as it uses less store/load
pairs for the loop variable.
2014-03-31 18:02:22 +01:00
Paul Sokolovsky
183faa3b13
tests: Add testcase for multiple inheritance.
2014-03-31 19:46:35 +03:00
Damien George
8cd72bdf92
py: Fix vstr_init for case that alloc = 0.
2014-03-31 17:10:59 +01:00
Damien George
43e92cfb52
Merge branch 'master' of github.com:micropython/micropython
2014-03-31 16:28:58 +01:00
Damien George
15d18069c5
py: Remove old "run time" functions that were 1 liners.
2014-03-31 16:28:13 +01:00
Damien George
f78b6df192
py: Disable dump_args function call entirely when not debugging.
...
Yes, I know, a good compiler will optimise this away, but I feel this is
neater.
2014-03-31 15:59:25 +01:00
Paul Sokolovsky
e566670153
objtype: Add virtual __name__ attribute.
...
It's virtual because it's not shown in dir(...). (That's also how CPython
has it).
2014-03-31 17:22:38 +03:00
Paul Sokolovsky
7da0660516
mp_resume: Dare to pass send_value of NULL.
...
There was thinkos that either send_value or throw_value is specified, but
there were cases with both. Note that send_value is pushed onto generator's
stack - but that's probably only good, because if we throw exception into
gen, it should not ever use send_value, and that will be just extra "assert".
2014-03-31 17:22:37 +03:00
Paul Sokolovsky
a2109d9321
mp_resume: Elaborate handling of .throw() for objects which lack it.
...
In this case, the exception is just re-thrown - the ideas is that object
doesn't handle this exception specially, so it will propagated per Python
semantics.
2014-03-31 17:22:37 +03:00
Paul Sokolovsky
817e76a1a5
objgenerator.throw(GeneratorExit) is not equivalent to .close().
...
.throw() propagates any exceptions, and .close() swallows them. Yielding
in reponse to .throw(GeneratorExit) is still fatal, and we need to
handle it for .throw() case separately (previously it was handled only
for .close() case).
Obscure corner cases due to test_pep380.py.
2014-03-31 17:22:37 +03:00
Paul Sokolovsky
1eac05d541
objgenerator: Another obscure case of propagating MP_OBJ_NULL optimization.
2014-03-31 17:22:37 +03:00
Damien George
e337f1ef5e
py: Towards default keyword arguments.
...
These are default arguments after a bare *.
2014-03-31 15:18:37 +01:00
jon mills
aabb314928
Update README.md
...
Very minor typo
2014-03-31 15:18:22 +01:00
Damien George
1aa2c10263
Merge branch 'master' of github.com:micropython/micropython
2014-03-31 12:01:09 +01:00
Damien George
523b575039
py: Add LOAD_NULL bytecode and use it to simplify function calls.
...
Adding this bytecode allows to remove 4 others related to
function/method calls with * and ** support. Will also help with
bytecodes that make functions/closures with default positional and
keyword args.
2014-03-31 11:59:23 +01:00
Damien George
3056509e00
py: Rename and reorder parameters in emit_make_function/closure.
...
In preparation for implementing default keyword arguments.
2014-03-31 11:30:17 +01:00
Paul Sokolovsky
6ded55a61f
py: Properly implement divide-by-zero handling.
...
"1/0" is sacred idiom, the shortest way to break program execution
(sys.exit() is too long).
2014-03-31 02:23:57 +03:00
Paul Sokolovsky
96ed213320
objfloat: Quick&dirty implementation of float floor division.
...
TODO: Likely doesn't match Python semantics for negative numbers.
2014-03-31 02:23:57 +03:00
Paul Sokolovsky
96eec4f8a6
compile: Don't try to constant-fold division by zero.
...
The way it is, just crashes app. And optimizing to
"raise ZeroDivisionError" is probably too much.
2014-03-31 02:23:57 +03:00
Paul Sokolovsky
864038dab7
objfloat: Make sure that floats always have dot (for C "double" type case).
...
This matches CPython behavior and hopefully can be treated as general
Python semantics.
2014-03-31 02:23:57 +03:00
Paul Sokolovsky
a8e60c1fde
objfloat: Missing default: caused incorrect results for unimplemented ops.
2014-03-31 02:23:56 +03:00
Paul Sokolovsky
a96d3d0840
objexcept: No more magic messages in exceptions, only exception arguments.
...
One of the reason for separate "message" (besides still unfulfilled desire to
optimize memory usage) was apparent special handling of exception with
messages by CPython. Well, the message is still just an exception argument,
it just printed specially. Implement that with PRINT_EXC printing format.
2014-03-31 02:23:56 +03:00
Damien George
e0f2979aed
py: Add equality test for None object.
2014-03-30 23:16:42 +01:00
Damien George
6433bd927a
py: Add explicit conversion from float to int via int().
2014-03-30 23:13:16 +01:00
Damien George
804760bfca
py: Fix bug in compiler for empty class bases.
...
Eg class A(): pass would fail an assertion.
2014-03-30 23:06:37 +01:00
Damien George
0997af932f
py: Don't wrap necessary function calls in assert.
2014-03-30 21:55:28 +01:00
Damien George
0aa4379543
Merge pull request #399 from pfalcon/gen-defargs
...
objgenerator: Handle default args to generator functions.
2014-03-30 21:51:49 +01:00
Paul Sokolovsky
f7eaf605c0
py: Fix "TypeError: 'iterator' object is not iterable", doh.
2014-03-30 23:37:24 +03:00
Paul Sokolovsky
f39d3b93da
py: Implement support for generalized generator protocol.
...
Iterators and ducktype objects can now be arguments of yield from.
2014-03-30 23:30:16 +03:00
Paul Sokolovsky
a30cf9f3af
objzip: Use mp_identity().
2014-03-30 23:30:15 +03:00
Damien George
230fec77d7
py: Implement positional and keyword args via * and **.
...
Extends previous implementation with * for function calls to * and **
for both function and method calls.
2014-03-30 21:21:24 +01:00
Damien George
f6a820903a
Merge pull request #396 from pfalcon/call-star
...
vm: Implement CALL_FUNCTION_VAR opcode (foo(*(1, 2, 3))).
2014-03-30 19:09:16 +01:00
Paul Sokolovsky
7fafb28f6d
objgenerator: Handle default args to generator functions.
...
Addresses #397 .
2014-03-30 20:25:19 +03:00