| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
| |
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 saves a lot of RAM for 2 reasons:
1. For functions that don't have default values, var args or var kw
args (which is a large number of functions in the general case), the
mp_obj_fun_bc_t type now fits in 1 GC block (previously needed 2 because
of the extra pointer to point to the arg_names array). So this saves 16
bytes per function (32 bytes on 64-bit machines).
2. Combining separate memory regions generally saves RAM because the
unused bytes at the end of the GC block are saved for 1 of the blocks
(since that block doesn't exist on its own anymore). So generally this
saves 8 bytes per function.
Tested by importing lots of modules:
- 64-bit Linux gave about an 8% RAM saving for 86k of used RAM.
- pyboard gave about a 6% RAM saving for 31k of used RAM.
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
Addressing issue #50.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Addresses issue #864.
|
|
|
|
|
| |
Also add start of ujson module with dumps implemented. Enabled in unix
and stmhal ports. Test passes on both.
|
|
|
|
| |
Tested and working on unix and pyboard.
|
|
|
|
| |
Addresses issue #848.
|
| |
|
| |
|
| |
|
|
|
|
| |
Part of code cleanup, working towards resolving issue #50.
|
|
|
|
| |
Part of code cleanup, working towards resolving issue #50.
|
|
|
|
| |
Part of code cleanup, to resolve issue #50.
|
|
|
|
| |
Part of code cleanup, towards resolving issue #50.
|
|
|
|
| |
Addressing issue #50, still some way to go yet.
|
|
|
|
|
| |
Found this bug by running unix/ tests with DEBUG=1 enabled when
compiling.
|
|
|
|
|
| |
Saves ROM (16 on stmhal, 240 on 64-bit unix) and should be quicker since
there is 1 less branch.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Addresses issue #724.
|
|
|
|
|
| |
This allows to create str's with a smaller length than initially asked
for.
|
|\
| |
| | |
Add support for storing args during an exception raised by an irq.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The user code should call micropython.alloc_emergency_exception_buf(size)
where size is the size of the buffer used to print the argument
passed to the exception.
With the test code from #732, and a call to
micropython.alloc_emergenncy_exception_buf(100) the following error is
now printed:
```python
>>> import heartbeat_irq
Uncaught exception in Timer(4) interrupt handler
Traceback (most recent call last):
File "0://heartbeat_irq.py", line 14, in heartbeat_cb
NameError: name 'led' is not defined
```
|
|/ |
|
|
|
|
| |
See discussion in issue #50.
|
|
|
|
|
|
|
|
|
| |
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).
|
| |
|
| |
|
|
|
|
| |
Should finish addressing issue #524.
|
|
|
|
|
| |
Also, make sure that args to "*" format specifiers are bounds-checked
properly and don't lead for segfaults in case of mismatch.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Also unifies use of SMALL_INT_FITS macro across parser and runtime.
|
|
|
|
| |
Addresses issue #627.
|
|
|
|
|
| |
This removes need for some casts (at least, more than it adds need
for new casts!).
|
| |
|
| |
|
|
|
|
|
| |
This means that complete slice operations are supported for lists (but not
for bytearray's and array.array's).
|
|
|
|
|
| |
Older int-only encoding is not expressive enough to support arbitrary slice
assignment operations.
|
|
|
|
| |
Addresses issue #598.
|
|
|
|
| |
See issue #608 for justification.
|
| |
|