summaryrefslogtreecommitdiffstatshomepage
path: root/py/objarray.c
Commit message (Collapse)AuthorAge
* py/objarray: Fix array.append so it doesn't extend if append fails.Damien George2016-04-07
| | | | Addresses issue #1965.
* py/objarray: Fix array slice assignment when array is reallocated.Damien George2016-03-14
| | | | Addresses issue #1898.
* py/objarray: Implement "in" operator for bytearray.Paul Sokolovsky2016-02-14
|
* py: Change first arg of type.make_new from mp_obj_t to mp_obj_type_t*.Damien George2016-01-11
| | | | | | | | The first argument to the type.make_new method is naturally a uPy type, and all uses of this argument cast it directly to a pointer to a type structure. So it makes sense to just have it a pointer to a type from the very beginning (and a const pointer at that). This patch makes such a change, and removes all unnecessary casting to/from mp_obj_t.
* py: Change type of .make_new and .call args: mp_uint_t becomes size_t.Damien George2016-01-11
| | | | | | | This patch changes the type signature of .make_new and .call object method slots to use size_t for n_args and n_kw (was mp_uint_t. Makes code more efficient when mp_uint_t is larger than a machine word. Doesn't affect ports when size_t and mp_uint_t have the same size.
* py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.Damien George2015-11-29
| | | | | | | | | This allows the mp_obj_t type to be configured to something other than a pointer-sized primitive type. This patch also includes additional changes to allow the code to compile when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of mp_uint_t, and various casts.
* py: Add MP_ROM_* macros and mp_rom_* types and use them.Damien George2015-11-29
|
* py: Rename MP_BOOL() to mp_obj_new_bool() for consistency in naming.Paul Sokolovsky2015-10-11
|
* py: Eliminate some cases which trigger unused parameter warnings.Damien George2015-09-04
|
* py: Use mp_not_implemented consistently for not implemented features.Damien George2015-09-03
|
* py: reduce array slice assignment code sizeDelio Brignoli2015-06-06
|
* py: Small code space optimisations for memoryview slice assigment.Damien George2015-07-20
| | | | | Also adds #if guards to allow uPy core to compile without memoryview enabled, but with slice assignment enabled.
* py: Implement memoryview slice assignment.Delio Brignoli2015-07-20
| | | | | Adds ability to do "memcpy" with memoryview objects, such as: m1[0:3] = m2[2:5].
* py/objarray.c: Allow to build with debugging and bytearray but no array.Damien George2015-07-02
|
* py/binary: Make return type of mp_binary_get_size size_t instead of int.Kaspar Schleiser2015-05-17
| | | | Fixes sign-compare warning.
* py: Overhaul and simplify printf/pfenv mechanism.Damien George2015-04-16
| | | | | | | | | | | | | | | | | | | | | | Previous to this patch the printing mechanism was a bit of a tangled mess. This patch attempts to consolidate printing into one interface. All (non-debug) printing now uses the mp_print* family of functions, mainly mp_printf. All these functions take an mp_print_t structure as their first argument, and this structure defines the printing backend through the "print_strn" function of said structure. Printing from the uPy core can reach the platform-defined print code via two paths: either through mp_sys_stdout_obj (defined pert port) in conjunction with mp_stream_write; or through the mp_plat_print structure which uses the MP_PLAT_PRINT_STRN macro to define how string are printed on the platform. The former is only used when MICROPY_PY_IO is defined. With this new scheme printing is generally more efficient (less layers to go through, less arguments to pass), and, given an mp_print_t* structure, one can call mp_print_str for efficiency instead of mp_printf("%s", ...). Code size is also reduced by around 200 bytes on Thumb2 archs.
* objarray: Support assignment of bytes to bytearray slice.Paul Sokolovsky2015-04-16
|
* py: Allow to compile with extra warnings (sign-compare, unused-param).Damien George2015-03-19
|
* objmemoryview: Introduce mp_obj_new_memoryview().Paul Sokolovsky2015-03-06
| | | | | This follows existing pattern for object constructor API and allows to create memoryview objects e.g. in external modules.
* objarray: Fix typo in null TYPECODE_MASK.Paul Sokolovsky2015-03-04
|
* py: Add MICROPY_MALLOC_USES_ALLOCATED_SIZE to allow simpler malloc API.Damien George2015-03-03
|
* objarray: Implement array slice assignment.Paul Sokolovsky2015-02-27
| | | | | | | | | | | | | | | | This is rarely used feature which takes enough code to implement, so is controlled by MICROPY_PY_ARRAY_SLICE_ASSIGN config setting, default off. But otherwise it may be useful, as allows to update arbitrary-sized data buffers in-place. Slice is yet to implement, and actually, slice assignment implemented in such a way that RHS of assignment should be array of the exact same item typecode as LHS. CPython has it more relaxed, where RHS can be any sequence of compatible types (e.g. it's possible to assign list of int's to a bytearray slice). Overall, when all "slice write" features are implemented, it may cost ~1KB of code.
* py: Use m_{new,renew,del} consistently.Damien George2015-02-27
| | | | This is so all memory requests go through the same interface.
* py, unix: Allow to compile with -Wunused-parameter.Damien George2015-01-20
| | | | See issue #699.
* objarray: Make sure that longint works as bytearray size.Paul Sokolovsky2015-01-04
|
* py: Move to guarded includes, everywhere in py/ core.Damien George2015-01-01
| | | | Addresses issue #1022.
* py: Allow bytes/bytearray/array to be init'd by buffer protocol objects.Damien George2014-12-04
| | | | | | | Behaviour of array initialisation is subtly different for bytes, bytearray and array.array when argument has buffer protocol. This patch gets us CPython conformant (except we allow initialisation of array.array by buffer with length not a multiple of typecode).
* py: Generalise and reduce code size of array +, += and .extend().Damien George2014-11-30
| | | | | | | | By using the buffer protocol for these array operations, we now allow addition of memoryview objects, and objects with "incompatible" typecodes (in this case it just adds bytes naively). This is an extension to CPython which seems sensible. It also reduces the code size.
* py: Implement +, += and .extend for bytearray and array objs.Damien George2014-11-30
| | | | Addresses issue #994.
* Fix errors after enabling -Wpointer-arithstijn2014-10-29
|
* py: Fix memoryview referencing so it retains ptr to original buffer.Damien George2014-10-26
| | | | | This way, if original parent object is GC'd, the memoryview still points to the underlying buffer data so that buffer is not GC'd.
* py: Add builtin memoryview object (mostly using array code).Damien George2014-10-23
|
* py: Convert [u]int to mp_[u]int_t where appropriate.Damien George2014-10-03
| | | | Addressing issue #50.
* py: Change uint to mp_uint_t in runtime.h, stackctrl.h, binary.h.Damien George2014-08-30
| | | | Part of code cleanup, working towards resolving issue #50.
* py: Remove use of int type in obj.h.Damien George2014-08-30
| | | | Part of code cleanup, working towards resolving issue #50.
* py: Change all uint to mp_uint_t in obj.h.Damien George2014-08-30
| | | | Part of code cleanup, working towards resolving issue #50.
* Change some parts of the core API to use mp_uint_t instead of uint/int.Damien George2014-08-30
| | | | Addressing issue #50, still some way to go yet.
* objarray: Implement equality testing between arrays and other buffers.Paul Sokolovsky2014-08-10
|
* py: Remove unnecessary argument in bytearray print.Damien George2014-07-17
|
* Rename machine_(u)int_t to mp_(u)int_t.Damien George2014-07-03
| | | | See discussion in issue #50.
* py: Allow to disable array module and bytearray type.Paul Sokolovsky2014-06-27
| | | | | array.array and bytearray share big deal of code, so to get real savings, both need to be disabled.
* objstr: Be 8-bit clean even for repr().Paul Sokolovsky2014-06-14
| | | | | | | | | This will allow roughly the same behavior as Python3 for non-ASCII strings, for example, print("<phrase in non-Latin script>".split()) will print list of words, not weird hex dump (like Python2 behaves). (Of course, that it will print list of words, if there're "words" in that phrase at all, separated by ASCII-compatible whitespace; that surely won't apply to every human language in existence).
* py: Small changes to objstr.c, including a bug fix.Damien George2014-06-05
| | | | | | | | | | | | | | Some small fixed: - Combine 'x' and 'X' cases in str format code. - Remove trailing spaces from some lines. - Make exception messages consistently begin with lower case (then needed to change those in objarray and objtuple so the same constant string data could be used). - Fix bug with exception message having %c instead of %%c.
* py: Fix configurability of builtin slice.Damien George2014-06-01
|
* objlist: Implement support for arbitrary (3-arg) slices.Paul Sokolovsky2014-05-25
|
* py: Refactor slice helpers, preparing to support arbitrary slicing.Paul Sokolovsky2014-05-25
|
* py: Rename MP_OBJ_NOT_SUPPORTED to MP_OBJ_NULL.Damien George2014-05-21
| | | | See issue #608 for justification.
* py, unix: Add copyright for modules I worked closely on.Paul Sokolovsky2014-05-13
|
* py: Fix prefix on few sequence helpers, was incorrectly "mp_".Paul Sokolovsky2014-05-10
|
* 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/.