summaryrefslogtreecommitdiff
path: root/py
AgeCommit message (Collapse)Author
2014-03-29py: Support mpz -op- float, mpz -op- complex, and complex -op- mpz.Damien George
2014-03-29py: Make MP_BC_SETUP_WITH use the bytecode stack for load_method.Damien George
The compiler allocates 7 entries on the stack for a with statement (following CPython, but probably can be reduced). This is enough for the method load and call in SETUP_WITH.
2014-03-29Merge pull request #389 from pfalcon/with-statementDamien George
With statement implementation
2014-03-29py: Fix regress with GeneratorExit object becoming truly const.Damien George
2014-03-29py: Rename old const type objects to mp_type_* for consistency.Damien George
2014-03-29py: Change mp_const_* objects to macros.Damien George
Addresses issue #388.
2014-03-29Merge pull request #383 from pfalcon/yield-fromDamien George
Implement "yield from"
2014-03-29py: Fix typo printing complex numbers that are purely imaginary.Damien George
2014-03-29py: Free unique_code slot for outer module.Damien George
Partly (very partly!) addresses issue #386. Most importantly, at the REPL command line, each invocation does not now lead to increased memory usage (unless you define a function/lambda).
2014-03-29vm: Implement "with" statement (SETUP_WITH and WITH_CLEANUP bytecodes).Paul Sokolovsky
2014-03-29vm: Make sure that exception triple is <type, instance, traceback>.Paul Sokolovsky
This reduntant triple is one of the ugliest parts of Python, which they chickened out to fix in Python3. We really should consider passing just as single exception instance (without breaking Python-level APIs of course), but until we do, let's follow CPython layout.
2014-03-29vm: Factor out exception block setup to a macro.Paul Sokolovsky
Will be reused in WITH bytecodes.
2014-03-29Merge pull request #382 from pfalcon/genexit-instDamien George
objgenerator: close(): Throw instance of GeneratorExit (not type).
2014-03-28py: Fix bugs with debugging output.Damien George
show_bc now decodes the prelude correctly. Moved WRITE_FILE stuff from runtime.c to emitglue.c. Addresses issue #385.
2014-03-28py: yield from: Elaborate GeneratorExit (gen.close()) handling.Paul Sokolovsky
Handling of GeneratorExit is really peculiar - it subverts normal exception propagation rules.
2014-03-28py: Core "yield from" implementation.Paul Sokolovsky
2014-03-28objgenerator: close(): Throw instance of GeneratorExit (not type).Paul Sokolovsky
To comply with Python semantics and allow use of mp_obj_is_subclass_fast() for exception matching.
2014-03-28showbc: Add few bytecodes related to "with".Paul Sokolovsky
2014-03-27py: Thin out predefined exceptions.Damien George
Only exceptions that are actually used are left prefedined. Hierarchy is still there, and removed exceptions are just commented out.
2014-03-27py: Fix typo printing complex numbers.Damien George
2014-03-27py: Rename emit_pre so they have globally unique names.Damien George
2014-03-27py: Factor out code from runtime.c to emitglue.c.Damien George
2014-03-27py: complex_print uses format_float if single precision fp used.Damien George
2014-03-27py: Put n_state for bytecode in the bytecode prelude.Damien George
Rationale: setting up the stack (state for locals and exceptions) is really part of the "code", it's the prelude of the function. For example, native code adjusts the stack pointer on entry to the function. Native code doesn't need to know n_state for any other reason. So putting the state size in the bytecode prelude is sensible. It reduced ROM usage on STM by about 30 bytes :) And makes it easier to pass information about the bytecode between functions.
2014-03-27py: Calculate maximum exception stack size in compiler.Damien George
2014-03-27py: Fix bug in type_store_attr, trying to store to ROM.Damien George
2014-03-26py: Restore CPython compatibility in compiler for closures with def args.Damien George
2014-03-26Merge pull request #381 from pfalcon/closure-defargsDamien George
py: Support closures with default args.
2014-03-26Merge branch 'master' of github.com:micropython/micropythonDamien George
2014-03-26py: Fix logic bugs in object attribute/method extraction.Damien George
2014-03-26py: Improved builtin dir.Damien George
2014-03-27py: Implement getattr() builtin.Paul Sokolovsky
2014-03-26Remove mp_obj_type_t.methods entry and use .locals_dict instead.Damien George
Originally, .methods was used for methods in a ROM class, and locals_dict for methods in a user-created class. That distinction is unnecessary, and we can use locals_dict for ROM classes now that we have ROMable maps. This removes an entry in the bloated mp_obj_type_t struct, saving a word for each ROM object and each RAM object. ROM objects that have a methods table (now a locals_dict) need an extra word in total (removed the methods pointer (1 word), no longer need the sentinel (2 words), but now need an mp_obj_dict_t wrapper (4 words)). But RAM objects save a word because they never used the methods entry. Overall the ROM usage is down by a few hundred bytes, and RAM usage is down 1 word per user-defined type/class. There is less code (no need to check 2 tables), and now consistent with the way ROM modules have their tables initialised. Efficiency is very close to equivaluent.
2014-03-26py: Support closures with default args.Paul Sokolovsky
2014-03-26Change mp_method_t.name from const char * to qstr.Damien George
Addresses issue #377.
2014-03-26py: Swap around the double return value of mp_obj_gen_resume.Damien George
Just to keep things consistent :)
2014-03-26py: Replace mp_const_stop_iteration object with MP_OBJ_NULL.Damien George
2014-03-26Merge pull request #379 from pfalcon/reraiseDamien George
vm: Implement raise statement w/o args (reraising last exception).
2014-03-26Merge branch 'master' of github.com:micropython/micropythonDamien George
2014-03-26py: Use _is_subclass_fast instead of _exception_match.Damien George
2014-03-26Merge branch 'gen-close-ret-val' of github.com:pfalcon/micropython into ↵Damien George
pfalcon-gen-close-ret-val
2014-03-26py: Add support for user-defined iterators via __iter__, __next__.Damien George
2014-03-26objexcept: Add mp_obj_exception_get_value() convenience function.Paul Sokolovsky
This gets "value" of exceptions in the sense as it's defined for StopIteration.value (i.e. args[0] or None). TODO: This really should be inline function.
2014-03-26vm: Implement raise statement w/o args (reraising last exception).Paul Sokolovsky
2014-03-26objgenerator: Implement return with value and .close() method.Paul Sokolovsky
Return with value gets converted to StopIteration(value). Implementation keeps optimizing against creating of possibly unneeded exception objects, so there're considerable refactoring to implement these features.
2014-03-25Merge pull request #370 from xbe/str-rfindDamien George
py/objstr.c: Implement str.rfind() and add tests for it, refactor find_subbytes().
2014-03-25py: Replace naive and teribble hash function with djb2.Damien George
2014-03-25py: Removed some unnecessary exception objects.Damien George
They still exist in commented-out form in objexcept.c if they are ever needed.
2014-03-25Proper support for registering builtin modules in ROM.Damien George
Comes with some refactoring of code and renaming of files. All modules are now named mod*.[ch].
2014-03-25Merge pull request #373 from iabdalkader/module_registerDamien George
Add mp_obj_module_register