summaryrefslogtreecommitdiffstatshomepage
path: root/py/obj.c
Commit message (Collapse)AuthorAge
* py: Fix mp_obj_print() to work when Python streams are not used.Paul Sokolovsky2015-02-17
|
* py: Revamp mp_obj_print() to use Python streams.Paul Sokolovsky2015-02-17
| | | | | | | Most of printing infrastructure now uses streams, but mp_obj_print() used libc's printf(), which led to weird buffering issues in output. So, switch mp_obj_print() to streams too, even though it may make sense to move it to a separate file, as it is purely a debugging function now.
* py: Check for NDEBUG using #ifdef rather than #if.Damien George2015-01-25
| | | | | Defining NDEBUG (to any value, even 0) disables debugging. Otherwise, if it's not defined, debugging is enabled.
* py, unix: Allow to compile with -Wsign-compare.Damien George2015-01-16
| | | | See issue #699.
* py: Can compile with -Wmissing-declarations and -Wmissing-prototypes.Damien George2015-01-12
|
* py: Implement fallback for equality check for all types.Damien George2015-01-11
| | | | | Return "not equal" for objects that don't implement equality check. This is as per Python specs.
* py: Move to guarded includes, everywhere in py/ core.Damien George2015-01-01
| | | | Addresses issue #1022.
* modsys: Add sys.print_exception(exc, file=sys.stdout) function.Paul Sokolovsky2014-12-08
| | | | | | | | | | | | The function is modeled after traceback.print_exception(), but unbloated, and put into existing module to save overhead on adding another module. Compliant traceback.print_exception() is intended to be implemented in micropython-lib in terms of sys.print_exception(). This change required refactoring mp_obj_print_exception() to take pfenv_t interface arguments. Addresses #751.
* py: Rename mp_obj_int_get to mp_obj_int_get_truncated; fix struct.pack.Damien George2014-12-05
| | | | | | | | | | | mp_obj_int_get_truncated is used as a "fast path" int accessor that doesn't check for overflow and returns the int truncated to the machine word size, ie mp_int_t. Use mp_obj_int_get_truncated to fix struct.pack when packing maximum word sized values. Addresses issues #779 and #998.
* py: Use __hash__ method if a type defines itstijn2014-11-15
|
* py: Use shorter, static error msgs when ERROR_REPORTING_TERSE enabled.Damien George2014-11-06
| | | | | | | | Going from MICROPY_ERROR_REPORTING_NORMAL to MICROPY_ERROR_REPORTING_TERSE now saves 2020 bytes ROM for ARM Thumb2, and 2200 bytes ROM for 32-bit x86. This is about a 2.5% code size reduction for bare-arm.
* py: Fix builtin callable so it checks user-defined instances correctly.Damien George2014-11-03
| | | | Addresses issue #953.
* py: Rename mp_builtin_id to mp_obj_id and make it public.Damien George2014-09-07
|
* 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
|