Age | Commit message (Collapse) | Author |
|
|
|
This is run with uncrustify 0.70.1, and black 19.10b0.
|
|
Most types are in rodata/ROM, and mp_obj_base_t.type is a constant pointer,
so enforce this const-ness throughout the code base. If a type ever needs
to be modified (eg a user type) then a simple cast can be used.
|
|
Instances of the slice class are passed to __getitem__() on objects when
the user indexes them with a slice. In practice the majority of the time
(other than passing it on untouched) is to work out what the slice means in
the context of an array dimension of a particular length. Since Python 2.3
there has been a method on the slice class, indices(), that takes a
dimension length and returns the real start, stop and step, accounting for
missing or negative values in the slice spec. This commit implements such
a indices() method on the slice class.
It is configurable at compile-time via MICROPY_PY_BUILTINS_SLICE_INDICES,
disabled by default, enabled on unix, stm32 and esp32 ports.
This commit also adds new tests for slice indices and for slicing unicode
strings.
|
|
|
|
Header files that are considered internal to the py core and should not
normally be included directly are:
py/nlr.h - internal nlr configuration and declarations
py/bc0.h - contains bytecode macro definitions
py/runtime0.h - contains basic runtime enums
Instead, the top-level header files to include are one of:
py/obj.h - includes runtime0.h and defines everything to use the
mp_obj_t type
py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h,
and defines everything to use the general runtime support functions
Additional, specific headers (eg py/objlist.h) can be included if needed.
|
|
There were several different spellings of MicroPython present in comments,
when there should be only one.
|
|
|
|
Saves 168 bytes on bare-arm.
|
|
|
|
These values are used to compute memory addresses and so size_t is the
more appropriate type to use.
|
|
|
|
Saves the following number of bytes of code space: 176 for bare-arm, 352
for minimal, 272 for unix x86-64, 140 for stmhal, 120 for esp8266.
|
|
See issue #2264.
|
|
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.
|
|
See issue #699.
|
|
See issue #699.
|
|
Addresses issue #1022.
|
|
Addressing issue #50.
|
|
Part of code cleanup, working towards resolving issue #50.
|
|
Part of code cleanup, working towards resolving issue #50.
|
|
See discussion in issue #50.
|
|
At this point, start will be >= 0, so checking if stop < 0 is redundant with
checking if start > stop a few lines later.
|
|
|
|
|
|
|
|
|
|
|
|
Older int-only encoding is not expressive enough to support arbitrary slice
assignment operations.
|
|
This time, in mp_seq_cmp_bytes(). How many more cases are still lurking?
|
|
|
|
|
|
Should support everything supported by strings.
|
|
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/.
|
|
Specifically, nlr.h does.
|
|
|
|
|
|
This does not affect code size or performance when debugging turned off.
To address issue #420.
|
|
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.
|
|
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.
|
|
Remove unnecessary includes. Add includes that improve portability.
|
|
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.
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Takes slice object and sequence length and computes subsequence indexes
for case of slice step=1.
|