| Commit message (Collapse) | Author | Age |
|
|
|
| |
Conditional on MICROPY_PY_ALL_SPECIAL_METHODS.
|
|
|
|
| |
Disabled by default. Enabled on unix and windows ports.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Given that there's already support for "fixed table" maps, which are
essentially ordered maps, the implementation of OrderedDict just extends
"fixed table" maps by adding an "is ordered" flag and add/remove
operations, and reuses 95% of objdict code, just making methods tolerant
to both dict and OrderedDict.
Some things are missing so far, like CPython-compatible repr and comparison.
OrderedDict is Disabled by default; enabled on unix and stmhal ports.
|
| |
|
|
|
|
|
| |
Still too shy to implement UnicodeEncodeError which was really needed for
micropython-lib case.
|
|
|
|
|
|
|
| |
The implementation of these functions is very large (order 4k) and they
are rarely used, so we don't enable them by default.
They are however enabled in stmhal and unix, since we have the room.
|
| |
|
|
|
|
| |
So corresponding exception can be thrown even under tight memory conditions.
|
| |
|
| |
|
|
|
|
| |
Addresses issue #1073.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This new config option sets how many fixed-number-of-bytes to use to
store the length of each qstr. Previously this was hard coded to 2,
but, as per issue #1056, this is considered overkill since no-one
needs identifiers longer than 255 bytes.
With this patch the number of bytes for the length is configurable, and
defaults to 1 byte. The configuration option filters through to the
makeqstrdata.py script.
Code size savings going from 2 to 1 byte:
- unix x64 down by 592 bytes
- stmhal down by 1148 bytes
- bare-arm down by 284 bytes
Also has RAM savings, and will be slightly more efficient in execution.
|
| |
|
|
|
|
|
|
| |
This allows to enable mem-info functions in micropython module, even if
MICROPY_MEM_STATS is not enabled. In this case, you get mem_info and
qstr_info but not mem_{total,current,peak}.
|
|
|
|
| |
Addresses issue #1022.
|
|
|
|
| |
Adds just 60 bytes to stmhal binary. Addresses issue #362.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
TODO: Merge useful functionality from modpyb too.
|
| |
|
| |
|
|
|
|
| |
Also, implement for unix port.
|
| |
|
|
|
|
|
|
| |
gc.enable/disable are now the same as CPython: they just control whether
automatic garbage collection is enabled or not. If disabled, you can
still allocate heap memory, and initiate a manual collection.
|
|
|
|
| |
Addresses issue #934.
|
|
|
|
|
|
|
|
|
|
|
| |
This allows to implement KeyboardInterrupt on unix, and a much safer
ctrl-C in stmhal port. First ctrl-C is a soft one, with hope that VM
will notice it; second ctrl-C is a hard one that kills anything (for
both unix and stmhal).
One needs to check for a pending exception in the VM only for jump
opcodes. Others can't produce an infinite loop (infinite recursion is
caught by stack check).
|
|
|
|
|
|
|
| |
This should be pretty compliant with CPython, except perhaps for some
corner cases to do with globals/locals context.
Addresses issue #879.
|
| |
|
| |
|
|
|
|
|
| |
It's purpose is for internal errors that are not catastrophic (ie not as
bad as RuntimeError). Since we don't use it, we don't need it.
|
|
|
|
|
|
|
| |
This makes open() and _io.FileIO() more CPython compliant.
The mode kwarg is fully iplemented.
The encoding kwarg is allowed but not implemented; mainly to allow
the tests to specify encoding for CPython, see #874
|
|
|
|
|
|
| |
Also, usocket.readinto(). Known issue is that .readinto() should be available
only for binary files, but micropython uses single method table for both
binary and text files.
|
| |
|
| |
|
|
|
|
| |
https://github.com/pfalcon/re1.5
|
|
|
|
|
|
|
|
|
|
|
| |
In CPython IOError (and EnvironmentError) is deprecated and aliased to
OSError. All modules that used to raise IOError now raise OSError (or a
derived exception).
In Micro Python we never used IOError (except 1 place, incorrectly) and
so don't need to keep it.
See http://legacy.python.org/dev/peps/pep-3151/ for background.
|
|
|
|
|
|
|
|
|
|
| |
Viper can now do the following:
def store(p:ptr8, c:int):
p[0] = c
This does a store of c to the memory pointed to by p using a machine
instructions inline in the code.
|
| |
|
| |
|
|
|
|
|
| |
Also add start of ujson module with dumps implemented. Enabled in unix
and stmhal ports. Test passes on both.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Addresses issue #827.
|
|
|
|
|
|
|
|
|
| |
Viper functions can now be annotated with the type of their arguments
and return value. Eg:
@micropython.viper
def f(x:int) -> int:
return x + 1
|
| |
|
|
|
|
| |
Also disable gc module on bare-arm port.
|
| |
|
|
|
|
|
|
|
|
| |
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).
|
|\
| |
| | |
Add support for storing args during an exception raised by an irq.
|