summaryrefslogtreecommitdiffstatshomepage
path: root/py/obj.c
Commit message (Collapse)AuthorAge
* py: Allow to pass buffer protocol flags to get_buffer helper funcs.Damien George2014-04-18
|
* py: Add typecode to buffer protocol.Damien George2014-04-18
| | | | | | | When querying an object that supports the buffer protocol, that object must now return a typecode (as per binary.[ch]). This does not have to be honoured by the caller, but can be useful for determining element size.
* py: Add MP_OBJ_STOP_ITERATION and make good use of it.Damien George2014-04-17
| | | | | Also make consistent use of MP_OBJ_NOT_SUPPORTED and MP_OBJ_NULL. This helps a lot in debugging and understanding of function API.
* py: Merge BINARY_OP_SUBSCR and store_subscr (w/ delete) into subscr.Damien George2014-04-17
| | | | mp_obj_t->subscr now does load/store/delete.
* py: Add len(bytes).Damien George2014-04-15
|
* py: Fix SyntaxError exception: don't have a block name, so pass NULL.Damien George2014-04-13
|
* py: Fix mp_get_buffer, and use it in more places.Damien George2014-04-13
| | | | | Must use mp_obj_get_type to get the type of an object. Can't assume mp_obj_t is castable to mp_obj_base_t.
* py: Make bytes type hashable.Paul Sokolovsky2014-04-13
|
* py: Convert some macros to inline functions (in obj.h).Damien George2014-04-11
| | | | | | Also convert mp_obj_is_integer to an inline function. Overall this decreased code size (at least on 32-bit x86 machine).
* py: Fix up object equality test.Damien George2014-04-11
| | | | | It regressed a bit after implementing float/complex equality. Now it should be improved, and support more equality tests.
* py: Simplify and improve mp_get_index.Damien George2014-04-11
| | | | | | | It has (again) a fast path for ints, and a simplified "slow" path for everything else. Also simplify the way str indexing is done (now matches tuple and list).
* py: Implement float and complex == and !=.Damien George2014-04-11
| | | | Addresses issue #462.
* py: Check that sequence has 2 elements for dict iterable constructor.Damien George2014-04-11
|
* py: Add mp_obj_is_integer; make mp_get_index check for long int.Damien George2014-04-09
| | | | | mp_obj_is_integer should be used to check if an object is of integral type. It returns true for bool, small int and long int.
* py: Add mp_get_buffer(), mp_get_buffer_raise() convenience functions to API.Paul Sokolovsky2014-04-09
|
* py: Change nlr_jump to nlr_raise, to aid in debugging.Damien George2014-04-05
| | | | | | This does not affect code size or performance when debugging turned off. To address issue #420.
* mp_obj_get_int(): Add warning against adding implicit float->int conversion.Paul Sokolovsky2014-04-05
|
* py: Allow types to be hashable.Paul Sokolovsky2014-04-05
| | | | Quite natural to have d[int] = handle_int .
* py: Remove mp_obj_less (use mp_binary_op(MP_BINARY_OP_LESS..) instead).Damien George2014-04-04
|
* py: More robust int conversion and overflow checking.Damien George2014-04-03
|
* py: Remove implicit conversion from int to float.Damien George2014-04-01
|
* Enhance str.format supportDave Hylands2014-04-01
| | | | | | | | | | | 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
* objexcept: No more magic messages in exceptions, only exception arguments.Paul Sokolovsky2014-03-31
| | | | | | | 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.
* py: Add equality test for None object.Damien George2014-03-30
|
* Merge map.h into obj.h.Damien George2014-03-30
| | | | | | 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.
* Rename rt_* to mp_*.Damien George2014-03-30
| | | | | | | 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.
* mp_obj_print_exception(): Assert that traceback has sane number of entries.Paul Sokolovsky2014-03-30
|
* py: Support mpz -op- float, mpz -op- complex, and complex -op- mpz.Damien George2014-03-29
|
* py: Rename old const type objects to mp_type_* for consistency.Damien George2014-03-29
|
* py: Change mp_const_* objects to macros.Damien George2014-03-29
| | | | Addresses issue #388.
* py: Remove obsolete declarations; make mp_obj_get_array consistent.Damien George2014-03-24
|
* py: Add function to convert long int to float.Damien George2014-03-22
|
* py: Allow hashing of functions and tuples.Damien George2014-03-20
|
* py: Clean up includes.xbe2014-03-17
| | | | Remove unnecessary includes. Add includes that improve portability.
* Fix issues in str.count implementation.xbe2014-03-13
| | | | See pull request #343.
* Implement str.count and add tests for it.xbe2014-03-12
| | | | | | | 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.
* Implement ROMable modules. Add math module.Damien George2014-03-08
| | | | | | | | | | 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).
* Implement proper exception type hierarchy.Damien George2014-02-15
| | | | | | | | | | | | | | 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.
* Change mp_obj_type_t.name from const char * to qstr.Damien George2014-02-15
| | | | | | 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.
* mp_obj_equal(): Instead of assert(), throw NotImplementedError.Paul Sokolovsky2014-02-11
| | | | With a nice traceback, helps debugging much better.
* unix microsocket: Add dummy makefile() method.Paul Sokolovsky2014-02-08
| | | | | | 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.
* py: Tidy up BINARY_OPs; negation done by special NOT bytecode.Damien George2014-02-01
| | | | | IS_NOT and NOT_IN are now compiled to IS + NOT and IN + NOT, with a new special NOT bytecode.
* py: Improve __bool__ and __len__ dispatch; add slots for them.Damien George2014-01-30
|
* Implement __bool__ and __len__ via unary_op virtual method for all types.Paul Sokolovsky2014-01-30
| | | | | | | __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.
* py: Add compile option to enable/disable source line numbers.Damien George2014-01-29
|
* py: Simpler implementation of mp_obj_callable.Damien George2014-01-23
|
* mp_obj_is_callable(): Only object types can be callable.Paul Sokolovsky2014-01-23
| | | | Fixes segfault on callable("string").
* Second stage of qstr revamp: uPy str object can be qstr or not.Damien George2014-01-22
|
* py: Remove implicit conversion of float to int in mp_obj_get_int().Damien George2014-01-22
| | | | Addresses Issue #199.
* Add len() support for arrays.Paul Sokolovsky2014-01-21
|