summaryrefslogtreecommitdiffstatshomepage
path: root/py/obj.c
Commit message (Collapse)AuthorAge
* py: Small simplifications in tuple and list accessors.Damien George2014-08-30
|
* py: Remove use of int type in obj.h.Damien George2014-08-30
| | | | Part of code cleanup, working towards resolving issue #50.
* py: Make tuple and list use mp_int_t/mp_uint_t.Damien George2014-08-30
| | | | Part of code cleanup, to resolve issue #50.
* py: Fix bug where GC collected native/viper/asm function data.Damien George2014-08-24
| | | | | | | | Because (for Thumb) a function pointer has the LSB set, pointers to dynamic functions in RAM (eg native, viper or asm functions) were not being traced by the GC. This patch is a comprehensive fix for this. Addresses issue #820.
* py: Implement builtin reversed() function.Damien George2014-08-12
| | | | | | | | reversed function now implemented, and works for tuple, list, str, bytes and user objects with __len__ and __getitem__. Renamed mp_builtin_len to mp_obj_len to make it publically available (eg for reversed).
* py: mp_buffer_info_t::buf may be valid, but NULL for empty objects.Paul Sokolovsky2014-08-10
| | | | | | This happens for example for zero-size arrays. As .get_buffer() method now has explicit return value, it's enough to distinguish success vs failure of getting buffer.
* py: Make MP_OBJ_NEW_SMALL_INT cast arg to mp_int_t itself.Damien George2014-07-31
| | | | Addresses issue #724.
* py: Make long ints hashable.Damien George2014-07-24
| | | | Addresses issue #765.
* Rename machine_(u)int_t to mp_(u)int_t.Damien George2014-07-03
| | | | See discussion in issue #50.
* stackctrl: Add "mp_" prefix.Paul Sokolovsky2014-07-01
|
* Merge branch 'master' into unicodeDamien George2014-06-28
|\ | | | | | | | | Conflicts: py/mpconfig.h
| * py: Add protection against printing too nested or recursive data structures.Paul Sokolovsky2014-06-28
| | | | | | | | With a test which cannot be automatically validated so far.
* | objstrunicode: Revamp len() handling for unicode, and optimize bool().Paul Sokolovsky2014-06-27
|/
* py: Separate MICROPY_PY_BUILTINS_COMPLEX from MICROPY_PY_BUILTINS_FLOAT.Paul Sokolovsky2014-06-20
| | | | | One thing is wanting to do 1 / 2 and get something else but 0, and quite another - doing rocket science ;-).
* Rename bultins config variables to MICROPY_PY_BUILTINS_*.Damien George2014-06-01
| | | | | | | | | | This renames: MICROPY_PY_FROZENSET -> MICROPY_PY_BUILTINS_FROZENSET MICROPY_PY_PROPERTY -> MICROPY_PY_BUILTINS_PROPERTY MICROPY_PY_SLICE -> MICROPY_PY_BUILTINS_SLICE MICROPY_ENABLE_FLOAT -> MICROPY_PY_BUILTINS_FLOAT See issue #35 for discussion.
* py: Rename MP_OBJ_NOT_SUPPORTED to MP_OBJ_NULL.Damien George2014-05-21
| | | | See issue #608 for justification.
* py: More const usage.Paul Sokolovsky2014-05-17
|
* py: Fix __len__ special method result handling.Paul Sokolovsky2014-05-11
| | | | Having both MP_OBJ_NOT_SUPPORTED and MP_OBJ_NULL is arguably confusing.
* py: Start making good use of mp_const_obj_t.Paul Sokolovsky2014-05-11
|
* py: Make mp_obj_print() handle null object w/o segfault if debug build.Paul Sokolovsky2014-05-10
| | | | Happens regularly when used for debugging.
* Add license header to (almost) all files.Damien George2014-05-03
| | | | | | | Blanket wide to all .c and .h files. Some files originating from ST are difficult to deal with (license wise) so it was left out of those. Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
* py, unix: Make "mpconfig.h" be first included, as other headers depend on it.Paul Sokolovsky2014-05-02
| | | | Specifically, nlr.h does.
* 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
|