summaryrefslogtreecommitdiff
path: root/py
AgeCommit message (Collapse)Author
2014-04-04py: Remove mp_obj_less (use mp_binary_op(MP_BINARY_OP_LESS..) instead).Damien George
2014-04-04Merge pull request #422 from dhylands/str-moduloDamien George
Str modulo
2014-04-04py: Enable optimisation of multiplying 2 small ints in compiler.Damien George
2014-04-04py: This time, real proper overflow checking of small int power.Damien George
Previous overflow test was inadequate.
2014-04-04py: Add m_malloc_fail function to handle memory allocation error.Damien George
A malloc/realloc fail now throws MemoryError.
2014-04-03Implements most of str.moduloDave Hylands
The alternate form for floating point doesn't work yet. The %(name)s form doesn't work yet.
2014-04-04py: Handle small int power overflow correctly.Damien George
2014-04-03Changes to get unix/ port compiling on Cygwin.Damien George
2014-04-03py: Add "io" module.Paul Sokolovsky
So far just includes "open" function, which should be supplied by a port. TODO: Make the module #ifdef'ed.
2014-04-03py: More robust int conversion and overflow checking.Damien George
2014-04-02Merge branch 'fix-format-int' of github.com:dhylands/micropython into ↵Damien George
dhylands-fix-format-int Conflicts: py/objstr.c
2014-04-02Fix str.format to work with {:f/g/e} and intsDave Hylands
Also fix objstr.c to compile when floats disabled.
2014-04-02py: Fix regress for printing of floats and #if.Damien George
Also change formating modifier in test script (it still passes with original format though).
2014-04-02gc: Uses uint defined in misc.h.Paul Sokolovsky
2014-04-02py: Wrap compile_scope_inline_asm in #if; remove comment from misc.h.Damien George
2014-04-02py: Fix up so that it can compile without float.Damien George
2014-04-02py: Enable a jump optimisation in the compiler.Damien George
2014-04-02py: Move to Python 3.4.0 compatibility.Damien George
Very little has changed. In Python 3.4 they removed the opcode STORE_LOCALS, but in Micro Python we only ever used this for CPython compatibility, so it was a trivial thing to remove. It also allowed to clean up some dead code (eg the 0xdeadbeef in class construction), and now class builders use 1 less stack word. Python 3.4.0 introduced the LOAD_CLASSDEREF opcode, which I have not yet understood. Still, all tests (apart from bytecode test) still pass. Bytecode tests needs some more attention, but they are not that important anymore.
2014-04-02py: Factor out static/class method unwrapping code; add tests.Damien George
2014-04-02py: Implement floating point power binop.Damien George
2014-04-02py: Allow multiple of str/list/tuple on left by an integer.Damien George
2014-04-02py: Add support for sep and end keywords in print.Damien George
2014-04-01py: Fix math.{ceil,floor,trunc} to return int.Damien George
2014-04-01py: Make pfenv.c conform to code conventions.Damien George
2014-04-01Reduce stack usage of pfenv_print_strnDave Hylands
2014-04-01Fix INT_BUF_SIZE to work with 32-bit and 64-bitDave Hylands
2014-04-01py: Remove implicit conversion from int to float.Damien George
2014-04-01Enhance str.format supportDave Hylands
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-03-31py: Implement __getattr__.Damien George
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-31objstr: Very basic implementation of % string formatting operator.Paul Sokolovsky
2014-03-31py: Wrap .__class__ handling in MICROPY_CPYTHON_COMPAT.Paul Sokolovsky
Because it's superfluos in the presence of type(), a remenant from Python's "old classes".
2014-03-31objtype: Wrap .__name__ handling in MICROPY_CPYTHON_COMPAT.Paul Sokolovsky
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-31py: Fix bug in optimised for .. range.Damien George
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-31py: Fix vstr_init for case that alloc = 0.Damien George
2014-03-31Merge branch 'master' of github.com:micropython/micropythonDamien George
2014-03-31py: Remove old "run time" functions that were 1 liners.Damien George
2014-03-31py: Disable dump_args function call entirely when not debugging.Damien George
Yes, I know, a good compiler will optimise this away, but I feel this is neater.
2014-03-31objtype: Add virtual __name__ attribute.Paul Sokolovsky
It's virtual because it's not shown in dir(...). (That's also how CPython has it).
2014-03-31mp_resume: Dare to pass send_value of NULL.Paul Sokolovsky
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-31mp_resume: Elaborate handling of .throw() for objects which lack it.Paul Sokolovsky
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-31objgenerator.throw(GeneratorExit) is not equivalent to .close().Paul Sokolovsky
.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-31objgenerator: Another obscure case of propagating MP_OBJ_NULL optimization.Paul Sokolovsky
2014-03-31py: Towards default keyword arguments.Damien George
These are default arguments after a bare *.
2014-03-31Merge branch 'master' of github.com:micropython/micropythonDamien George
2014-03-31py: Add LOAD_NULL bytecode and use it to simplify function calls.Damien George
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-31py: Rename and reorder parameters in emit_make_function/closure.Damien George
In preparation for implementing default keyword arguments.
2014-03-31py: Properly implement divide-by-zero handling.Paul Sokolovsky
"1/0" is sacred idiom, the shortest way to break program execution (sys.exit() is too long).
2014-03-31objfloat: Quick&dirty implementation of float floor division.Paul Sokolovsky
TODO: Likely doesn't match Python semantics for negative numbers.
2014-03-31compile: Don't try to constant-fold division by zero.Paul Sokolovsky
The way it is, just crashes app. And optimizing to "raise ZeroDivisionError" is probably too much.
2014-03-31objfloat: Make sure that floats always have dot (for C "double" type case).Paul Sokolovsky
This matches CPython behavior and hopefully can be treated as general Python semantics.