aboutsummaryrefslogtreecommitdiff
path: root/py/obj.h
AgeCommit message (Collapse)Author
2014-01-20mp_identity(): Add generic identity function.Paul Sokolovsky
Useful as getiter method for objects which are their own iterators, etc.
2014-01-20Properly print MP_OBJ_QSTR objects.Paul Sokolovsky
2014-01-20Implement modules as singletons Python semantics.Paul Sokolovsky
In Python, importing module several times returns same underlying module object. This also fixes import statement handling for builtin modules. There're still issues: 1. CPython exposes set of loaded modules as sys.modules, we may want to do that either. 2. Builtin modules are implicitly imported, which is not really correct. We should separate registering a (builtin) module and importing a module. CPython keeps builtin module names in sys.builtin_module_names .
2014-01-19Change int to uint for n_args in function with variable arguments.Damien George
2014-01-19py: Add full traceback to exception printing.Damien George
2014-01-19py: Add module/function/class name to exceptions.Damien George
Exceptions know source file, line and block name. Also tidy up some debug printing functions and provide a global flag to enable/disable them.
2014-01-18Merge pull request #192 from pfalcon/arraysDamien George
Add skeleton implementation of array.array and bytearray.
2014-01-18Add source file name and line number to error messages.Damien George
Byte code has a map from byte-code offset to source-code line number, used to give better error messages.
2014-01-18Add skeleton implementation of array.array and bytearray.Paul Sokolovsky
So far, only storage, initialization, repr() and buffer protocol is implemented - alredy suitable for passing binary data around.
2014-01-18Merge pull request #191 from pfalcon/store-itemDamien George
Add store_item() virtual method to type to implement container[index] = val
2014-01-18Merge branch 'master' of github.com:dpgeorge/micropythonDamien George
2014-01-18int: Add value accessors: mp_obj_int_get() & mp_obj_int_get_checked().Paul Sokolovsky
mp_obj_int_get() can be used when just full resolution of C machine_int_t is required (returns truncated value of long int). mp_obj_int_get_checked() will throw exception if Python int value not representable in machine_int_t.
2014-01-18Make VM stack grow upwards, and so no reversed args arrays.Damien George
Change state layout in VM so the stack starts at state[0] and grows upwards. Locals are at the top end of the state and number downwards. This cleans up a lot of the interface connecting the VM to C: now all functions that take an array of Micro Python objects are in order (ie no longer in reverse). Also clean up C API with keyword arguments (call_n and call_n_kw replaced with single call method that takes keyword arguments). And now make_new takes keyword arguments. emitnative.c has not yet been changed to comply with the new order of stack layout.
2014-01-18Add store_item() virtual method to type to implement container[index] = val.Paul Sokolovsky
2014-01-15stm: Fix print methods with new kind argument.Damien George
2014-01-15Merge branch 'str2int' of github.com:xyb/micropython into xyb-str2intDamien George
Conflicts: py/objint.c unix-cpy/Makefile unix/Makefile
2014-01-15Merge branch 'str-repr' of github.com:pfalcon/micropython into pfalcon-str-reprDamien George
Conflicts: tests/basics/tests/exception1.py
2014-01-15added filter()John R. Lenton
2014-01-15Added mapJohn R. Lenton
2014-01-15type->print(): Distinguish str() and repr() variety by passing extra param.Paul Sokolovsky
2014-01-14Merge remote-tracking branch 'upstream/master' into builtinsJohn R. Lenton
2014-01-14added enumerate()John R. Lenton
2014-01-14Tidy up.Damien George
2014-01-14Implemented int(str) in UNIXxyb
2014-01-13Made sorted() raise an exception instead of aborting when given no ↵John R. Lenton
arguments; moved around some things in objfun.c as a consequence
2014-01-13Cleaned up sorted() as per Damien's suggestions.John R. Lenton
2014-01-13added zip()John R. Lenton
2014-01-12Add framework to support alternative implementations of long int Python type.Paul Sokolovsky
2014-01-12Add proper checks for fits-in-small-int. Make it reusable.Paul Sokolovsky
We likely should make mp_obj_new_int() inline, and rely on its encapsulated check rather than inline checks everywhere explicitly. Also, parser for big small int values is still broken.
2014-01-11py: Implement staticmethod and classmethod (internally).Damien George
Still need to make built-ins by these names, and write tests.
2014-01-11unified the bopsJohn R. Lenton
2014-01-10Added dict.fromkeys. Are we done with dict and #99 yet? I do think we are.John R. Lenton
2014-01-09py: Implement base class lookup, issubclass, isinstance.Damien George
2014-01-09Improved type/class/instance code; mp_obj_type_t now has load_attr, store_attr.Damien George
Creating of classes (types) and instances is much more like CPython now. You can use "type('name', (), {...})" to create classes.
2014-01-08py: add variable argument exception constructor function.Damien George
Addresses issue #104.
2014-01-08Merge pull request #114 from pfalcon/streams-bootstrapDamien George
Define buffer and stream protocols, and other starting bits of io.* framework, with io.FileIO-like implementation for Unix
2014-01-08py: Stuff qstr in object pointer; keys for mp_map_t are now always mp_obj_t.Damien George
2014-01-08Add support for stream and buffer protocols.Paul Sokolovsky
Stream protocol is abstraction of serial I/O. Buffer protocol is abstraction of random-access I/O. These protocols are defined down to C level, to allow generic, while still efficient algorithms to be coded in C (like, buffered transfer between 2 stream objects, saving/loading of buffer object to/from stream, etc). (Note that CPython define buffer protocol on C level, but apparently not stream protocol).
2014-01-08py: Improve __build_class__.Damien George
2014-01-07py: Small big fix to type declarations.Damien George
2014-01-07Merge remote-tracking branch 'upstream/master' into listsort. Lots of ↵John R. Lenton
conflict fun. Conflicts: py/obj.h py/objbool.c py/objboundmeth.c py/objcell.c py/objclass.c py/objclosure.c py/objcomplex.c py/objdict.c py/objexcept.c py/objfun.c py/objgenerator.c py/objinstance.c py/objmodule.c py/objrange.c py/objset.c py/objslice.c
2014-01-07This implements a better (more python-conformant) list.sort.John R. Lenton
It's not really about that, though; it's about me figuring out a sane way forward for keyword-argument functions (and function metadata). But it's useful as is, and shouldn't break any existing code, so here you have it; I'm going to park it in my mind for a bit while sorting out the rest of the dict branch.
2014-01-07Merge branch 'cplusplus' of https://github.com/ian-v/micropython into ↵Damien George
ian-v-cplusplus Conflicts: py/objcomplex.c
2014-01-06py: Fix up number operations and coercion.Damien George
2014-01-06Revert MP_BOOL, etc. and use <stdbool.h> insteadian-v
2014-01-06Co-exist with C++ (issue #85)ian-v
2014-01-05Merge remote-tracking branch 'upstream/master' into list_insertJohn R. Lenton
2014-01-04Convert Python types to proper Python type hierarchy.Damien George
Now much more inline with how CPython does types.
2014-01-04Add ellipsis object.Damien George
2014-01-04Merge remote-tracking branch 'upstream/master' into list_insertJohn R. Lenton