aboutsummaryrefslogtreecommitdiff
path: root/py/obj.c
AgeCommit message (Collapse)Author
2014-04-09py: Add mp_get_buffer(), mp_get_buffer_raise() convenience functions to API.Paul Sokolovsky
2014-04-05py: Change nlr_jump to nlr_raise, to aid in debugging.Damien George
This does not affect code size or performance when debugging turned off. To address issue #420.
2014-04-05mp_obj_get_int(): Add warning against adding implicit float->int conversion.Paul Sokolovsky
2014-04-05py: Allow types to be hashable.Paul Sokolovsky
Quite natural to have d[int] = handle_int .
2014-04-04py: Remove mp_obj_less (use mp_binary_op(MP_BINARY_OP_LESS..) instead).Damien George
2014-04-03py: More robust int conversion and overflow checking.Damien George
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-31objexcept: No more magic messages in exceptions, only exception arguments.Paul Sokolovsky
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-30py: Add equality test for None object.Damien George
2014-03-30Merge map.h into obj.h.Damien George
Pretty much everyone needs to include map.h, since it's such an integral part of the Micro Python object implementation. Thus, the definitions are now in obj.h instead. map.h is removed.
2014-03-30Rename rt_* to mp_*.Damien George
Mostly just a global search and replace. Except rt_is_true which becomes mp_obj_is_true. Still would like to tidy up some of the names, but this will do for now.
2014-03-30mp_obj_print_exception(): Assert that traceback has sane number of entries.Paul Sokolovsky
2014-03-29py: Support mpz -op- float, mpz -op- complex, and complex -op- mpz.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-24py: Remove obsolete declarations; make mp_obj_get_array consistent.Damien George
2014-03-22py: Add function to convert long int to float.Damien George
2014-03-20py: Allow hashing of functions and tuples.Damien George
2014-03-17py: Clean up includes.xbe
Remove unnecessary includes. Add includes that improve portability.
2014-03-13Fix issues in str.count implementation.xbe
See pull request #343.
2014-03-12Implement str.count and add tests for it.xbe
Also modify mp_get_index to accept: 1. Indices that are or evaluate to a boolean. 2. Slice indices. Add tests for these two cases.
2014-03-08Implement ROMable modules. Add math module.Damien George
mp_module_obj_t can now be put in ROM. Configuration of float type is now similar to longint: can now choose none, float or double as the implementation. math module has basic math functions. For STM port, these are not yet implemented (they are just stub functions).
2014-02-15Implement proper exception type hierarchy.Damien George
Each built-in exception is now a type, with base type BaseException. C exceptions are created by passing a pointer to the exception type to make an instance of. When raising an exception from the VM, an instance is created automatically if an exception type is raised (as opposed to an exception instance). Exception matching (RT_BINARY_OP_EXCEPTION_MATCH) is now proper. Handling of parse error changed to match new exceptions. mp_const_type renamed to mp_type_type for consistency.
2014-02-15Change mp_obj_type_t.name from const char * to qstr.Damien George
Ultimately all static strings should be qstr. This entry in the type structure is only used for printing error messages (to tell the type of the bad argument), and printing objects that don't supply a .print method.
2014-02-11mp_obj_equal(): Instead of assert(), throw NotImplementedError.Paul Sokolovsky
With a nice traceback, helps debugging much better.
2014-02-08unix microsocket: Add dummy makefile() method.Paul Sokolovsky
Unlike CPython socket, microsocket object already implements stream protocol (read/write methods), so makefile() just returns object itself. TODO: this doesn't take care of arguments CPython's makefile() may accept.
2014-02-01py: Tidy up BINARY_OPs; negation done by special NOT bytecode.Damien George
IS_NOT and NOT_IN are now compiled to IS + NOT and IN + NOT, with a new special NOT bytecode.
2014-01-30py: Improve __bool__ and __len__ dispatch; add slots for them.Damien George
2014-01-30Implement __bool__ and __len__ via unary_op virtual method for all types.Paul Sokolovsky
__bool__() and __len__() are just the same as __neg__() or __invert__(), and require efficient dispatching implementation (not requiring search/lookup). type->unary_op() is just the right choice for this short of adding standalone virtual method(s) to already big mp_obj_type_t structure.
2014-01-29py: Add compile option to enable/disable source line numbers.Damien George
2014-01-23py: Simpler implementation of mp_obj_callable.Damien George
2014-01-23mp_obj_is_callable(): Only object types can be callable.Paul Sokolovsky
Fixes segfault on callable("string").
2014-01-22Second stage of qstr revamp: uPy str object can be qstr or not.Damien George
2014-01-22py: Remove implicit conversion of float to int in mp_obj_get_int().Damien George
Addresses Issue #199.
2014-01-21Add len() support for arrays.Paul Sokolovsky
2014-01-21Merge branch 'master' of github.com:micropython/micropythonDamien George
Conflicts: py/objstr.c py/py.mk py/stream.c unix/main.c unix/socket.c
2014-01-21Revamp qstrs: they now include length and hash.Damien George
Can now have null bytes in strings. Can define ROM qstrs per port using qstrdefsport.h
2014-01-20mp_obj_get_type_str(): Handle MP_OBJ_QSTR.Paul Sokolovsky
2014-01-20mp_identity(): Add generic identity function.Paul Sokolovsky
Useful as getiter method for objects which are their own iterators, etc.
2014-01-20mp_obj_get_qstr(): Handle MP_OBJ_QSTR.Paul Sokolovsky
2014-01-20Properly print MP_OBJ_QSTR objects.Paul Sokolovsky
2014-01-19py: Add full traceback to exception printing.Damien George
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-15type->print(): Distinguish str() and repr() variety by passing extra param.Paul Sokolovsky
2014-01-13mp_obj_equal(): Compare small and long ints properly.Paul Sokolovsky
By dispatching to long int methods.
2014-01-12mp_obj_equal(): For non-trivial types, call out to type's special method.Paul Sokolovsky
2014-01-11py: Implement staticmethod and classmethod (internally).Damien George
Still need to make built-ins by these names, and write tests.