summaryrefslogtreecommitdiff
path: root/py
AgeCommit message (Collapse)Author
2014-04-09py: str.join can now take arbitrary iterable as argument.Damien George
2014-04-09py: Generators can have their locals closed over.Damien George
2014-04-09py: Properly implement deletion of locals and derefs, and detect errors.Damien George
Needed to reinstate 2 delete opcodes, to specifically check that a local is not deleted twice.
2014-04-09py, compiler: Turn id_info_t.param into a set of flags.Damien George
So we can add more flags.
2014-04-09py, compile: Simplify initialisation of compiler structure.Damien George
2014-04-09py, compile: Reduce size of compiler structure.Damien George
2014-04-09py, compile: Combine have_star_arg, have_dbl_star_arg into star_flags.Damien George
Small reduction in ROM, heap and stack usage.
2014-04-09py, compiler: Clean up and compress scope/compile structures.Damien George
Convert int types to uint where sensible, and then to uint8_t or uint16_t where possible to reduce RAM usage.
2014-04-09gc.c: Remove superfluous typedef (bute defined in misc.h).Paul Sokolovsky
2014-04-08py: Make it so that printing a small int does not allocate heap memory.Damien George
With the implementation of proper string formatting, code to print a small int was delegated to mpz_as_str_inpl (after first converting the small int to an mpz using stack memory). But mpz_as_str_inpl allocates heap memory to do the conversion, so small ints needed heap memory just to be printed. This fix has a separate function to print small ints, which does not allocate heap, and allocates less stack. String formatting, printf and pfenv are now large beasts, with some semi-duplicated code.
2014-04-08Merge branch 'master' of github.com:micropython/micropythonDamien George
2014-04-08py: Add comment mpz function, and free memory used for string printing.Damien George
2014-04-09objint: Implement int.from_bytes() class method and .to_bytes() method.Paul Sokolovsky
These two are apprerently the most concise and efficient way to convert int to/from bytes in Python. The alternatives are struct and array modules, but methods using them are more verbose in Python code and less efficient in memory/cycles.
2014-04-09py: Add mp_get_buffer(), mp_get_buffer_raise() convenience functions to API.Paul Sokolovsky
2014-04-08py: Reinstate old pfenv_print_int function for stmhal's printf.Damien George
2014-04-08py: Remove obsolete mp_delete_subscr declaration.Damien George
2014-04-08py: Remove DELETE_SUBSCR opcode, combine with STORE_SUBSCR.Damien George
This makes the runtime and object APIs more consistent. mp_store_subscr functionality now moved into objects (ie list and dict store_item).
2014-04-08Merge branch 'master' of github.com:micropython/micropythonDamien George
2014-04-08py: Finish implementation of all del opcodes.Damien George
At this point, all opcodes are now implemented! Some del opcodes have been combined with store opcodes, with the value to store being MP_OBJ_NULL.
2014-04-08py: Make bytearray a proper type.Paul Sokolovsky
2014-04-08Merge branch 'master' of github.com:micropython/micropythonDamien George
2014-04-08py: Improve inline assembler; add a few more opcodes.Damien George
2014-04-08py: implement UNPACK_EX byte code (for: a, *b, c = d)Damien George
2014-04-08bytes: Support buffer protocol.Paul Sokolovsky
2014-04-08bytearray: Support bytearray(int) constructor.Paul Sokolovsky
To create bytearray of given length.
2014-04-08py: Raise exception for unimplemented byte codes.Damien George
2014-04-08py: Improve compiler syntax errors; catch more errors.Damien George
2014-04-08Add a check for NULL nlr_top in nlr_jump.Damien George
If no nlr_buf has been pushed, and an nlr_jump is called, then control is transferred to nlr_jump_fail (which should bail out with a fatal error).
2014-04-08py: Continue line if last character is backslash.Damien George
2014-04-08py: Improve GC locking/unlocking, and make it part of the API.Damien George
2014-04-08Merge pull request #451 from lurch/repr-fixesDamien George
Display \r and \t escape codes in string repr
2014-04-08Improve REPL detecting when input needs to continue.Damien George
Full CPython compatibility with this requires actually parsing the input so far collected, and if it fails parsing due to lack of tokens, then continue collecting input. It's not worth doing it this way. Not having compatibility at this level does not hurt the goals of Micro Python.
2014-04-08Display \r and \t escape codes in string reprAndrew Scheller
2014-04-08py: Rename pfenv_print_int to pfenv_print_mp_int, and add back former.Damien George
stmhal relies on pfenv_* to implement its printf. Thus, it needs a pfenv_print_int which prints a proper 32-bit integer. With latest change to pfenv, this function became one that took mp_obj_t, and extracted the integer value from that object. To fix temporarily, pfenv_print_int has been renamed to pfenv_print_mp_int (to indicate it takes a mp_obj_t for the int), and pfenv_print_int has been added (which takes a normal C int). Currently, pfenv_print_int proxies to pfenv_print_mp_int, but this means it looses the MSB. Need to find a way to fix this, but the only way I can think of will duplicate lots of code.
2014-04-07Fix truncation problem when using longlong implementation.Dave Hylands
2014-04-07Add string formatting support for longlong and mpz.Dave Hylands
2014-04-07Merge pull request #439 from lurch/makefile-tweaksDamien George
Makefile tweaks
2014-04-07py: Detect unmatched tripple quote in repl helper.Damien George
2014-04-07Merge remote-tracking branch 'upstream/master' into makefile-tweaksAndrew Scheller
2014-04-07Replace some Makefile commands with variables in py/mkenv.mkAndrew Scheller
2014-04-07py: Revert revert for allocation policy of set hash table.Damien George
2014-04-07objset: Fix incorrect workaround against mp_set_init() munging alloc size.Paul Sokolovsky
No longer needed after recent change which guarantees that mp_set_init() will allocate exact number of slots requested.
2014-04-07py: Revert change to allocation policy for mp_set_t.Damien George
Seems that this fixes all set tests.
2014-04-07py: Fix str.replace for case when arg 0 or 1 is empty string.Damien George
2014-04-06objdict: Implement equality operator.Paul Sokolovsky
Sure, it's O(n^2).
2014-04-06py: Fix dict.copy() and low-level map/set allocation.Paul Sokolovsky
Two things: 1) set flags in copy properly; make mp_map_init() not be too smart and do something with requested alloc size. Policy of using prime numbers for alloc size is high-level policy which should be applied at corresponding high levels. Low-level functions should just do what they're asked to, because they don't have enough context to be smarter than that. For example, munging with alloc size of course breaks dict copying (as changing sizes requires rehashing).
2014-04-06objdict: Support creating dict from another dict.Paul Sokolovsky
2014-04-06py: Implement more features in native emitter.Damien George
On x64, native emitter now passes 70 of the tests.
2014-04-06py: Add option to compiler to specify default code emitter.Damien George
Also add command line option to unix port to select emitter.
2014-04-06py: str.split: handle non-default separator.Damien George