| Commit message (Collapse) | Author | Age |
|
|
|
| |
This allows stmhal to be compiled with MICROPY_DEBUG_PRINTERS.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previous to this patch a call such as list.append(1, 2) would lead to a
seg fault. This is because list.append is a builtin method and the first
argument to such methods is always assumed to have the correct type.
Now, when a builtin method is extracted like this it is wrapped in a
checker object which checks the the type of the first argument before
calling the builtin function.
This feature is contrelled by MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG and
is enabled by default.
See issue #1216.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
mpconfigport.mk contains configuration options which affect the way
MicroPython is linked. In this regard, it's "stronger" configuration
dependency than even mpconfigport.h, so if we rebuild everything on
mpconfigport.h change, we certianly should of that on mpconfigport.mk
change too.
|
|
|
|
| |
Enabled simply by making the identifier lexing code 8-bit clean.
|
|
|
|
|
|
| |
If heap allocation for the Python-stack of a function fails then we may
as well allocate the Python-stack on the C stack. This will allow to
run more code without using the heap.
|
|
|
|
|
| |
This requires some special handling, which was previosuly applied only to
the main code path.
|
| |
|
|
|
|
| |
See issue #1306.
|
| |
|
|
|
|
|
|
|
| |
This allows to do "ar[i]" and "ar[i] = val" in viper when ar is a Python
object and i and/or val are native viper types (eg ints).
Patch also includes tests for this feature.
|
|
|
|
|
|
| |
Eg, builtin map can map over a map, etc, and call iternext deeply.
Addresses issue #1294.
|
| |
|
|
|
|
|
|
|
|
|
| |
This patch converts Q(abc) to "Q(abc)" to protect the abc from the
C preprocessor, then converts back after the preprocessor is finished.
So now we can safely put includes in mpconfig(port).h, and also
preprocess qstrdefsport.h (latter is now done also in this patch).
Addresses issue #1252.
|
|
|
|
| |
"raise" is a common word that was found to exist in a vendor's stdlib.
|
|
|
|
| |
This patch was needed for gcc 4.4.
|
|
|
|
|
| |
These scripts should run under as wide a range of Python versions as
possible.
|
|
|
|
|
|
|
| |
C's printf will pad nan/inf differently to CPython. Our implementation
originally conformed to C, now it conforms to CPython's way.
Tests for this are also added in this patch.
|
|
|
|
| |
Saves around 120 bytes on Thumb2 archs.
|
|
|
|
| |
Addresses issue #1285.
|
|
|
|
| |
It's configurable and only enabled for stmhal port.
|
| |
|
|
|
|
|
|
| |
This drops the size of unicode_isxdigit from 0x1e + 0x02 filler to
0x14 bytes (so net code reduction of 12 bytes) and will make
unicode_is_xdigit perform slightly faster.
|
|
|
|
| |
This also pulls out hex_digit from py/lexer.c and makes unichar_hex_digit
|
|
|
|
|
|
|
| |
This allows using (almost) the same code for printing floats everywhere,
removes the dependency on sprintf and uses just snprintf and
applies an msvc-specific fix for snprintf in a single place so
nan/inf are now printed correctly.
|
|
|
|
| |
Fixes sign-compare warning.
|
| |
|
|
|
|
|
| |
ISO C forbids conversion between function pointers and void*, gcc
-pedantic triggers a warning.
|
|
|
|
|
| |
Background: trying to make an amalgamation of all the code gave some
errors with redefined types and inconsistent use of static.
|
| |
|
|
|
|
|
|
| |
mp_obj_get_int_truncated will raise a TypeError if the argument is not
an integral type. Use mp_obj_int_get_truncated only when you know the
argument is a small or big int.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Hashing is now done using mp_unary_op function with MP_UNARY_OP_HASH as
the operator argument. Hashing for int, str and bytes still go via
fast-path in mp_unary_op since they are the most common objects which
need to be hashed.
This lead to quite a bit of code cleanup, and should be more efficient
if anything. It saves 176 bytes code space on Thumb2, and 360 bytes on
x86.
The only loss is that the error message "unhashable type" is now the
more generic "unsupported type for __hash__".
|
|
|
|
| |
I.e. in bytecode Python functions.
|
|
|
|
|
|
| |
Unfortunately, MP_OBJ_STOP_ITERATION doesn't have means to pass an associated
value, so we can't optimize StopIteration exception with (non-None) argument
to MP_OBJ_STOP_ITERATION.
|
|
|
|
|
| |
MP_OBJ_STOP_ITERATION is equivalent of raising StopIteration, except
mp_vm_return_kind_t for it is "yield".
|
|
|
|
|
|
|
| |
When generator raises exception, it is automatically terminated (by setting
its code_state.ip to 0), which interferes with this check.
Triggered in particular by CPython's test_pep380.py.
|
|
|
|
|
|
|
|
|
|
| |
Exceptions in .close() should be ignored (dumped to sys.stderr, not
propagated), but in uPy, they are propagated. Fix would require
nlr-wrapping .close() call, which is expensive. Bu on the other hand,
.close() is not called often, so maybe that's not too bad (depends,
if it's finally called and that causes stack overflow, there's nothing
good in that). And yet on another hand, .close() can be implemented to
catch exceptions on its side, and that should be the right choice.
|
|
|
|
|
| |
Testing for incorrect value led to premature termination of generator
containing yield from for such iterator (e.g. "yield from [1, 2]").
|
|
|
|
|
|
| |
The code was apparently broken after 9988618e0e0f5c319e31b135d993e22efb593093
"py: Implement full func arg passing for native emitter.". This attempts to
propagate those changes to ARM emitter.
|
|
|
|
| |
Also remove __debug__ from one of the bytecode tests.
|
|
|
|
| |
Addresses issue #1226.
|
|
|
|
| |
(Windows compatibility.)
|
|
|
|
|
| |
so that resulting file is correct also on windows systems (ie.
with file names containing drive letter).
|
|
|
|
|
| |
Ellipsis constant is rarely used so no point having an extra bytecode
for it.
|
|
|
|
|
|
| |
User instances are hashable by default (using __hash__ inherited from
"object"). But if __eq__ is defined and __hash__ not defined in particular
class, instance is not hashable.
|
|
|
|
|
|
|
| |
Having NotImplemented as MP_OBJ_SENTINEL turned out to be problematic
(it needs to be checked for in a lot of places, otherwise it'll crash
as would pass MP_OBJ_IS_OBJ()), so made a proper singleton value like
Ellipsis, both of them sharing the same type.
|
|
|
|
|
|
|
|
|
|
|
|
| |
From https://docs.python.org/3/library/constants.html#NotImplemented :
"Special value which should be returned by the binary special methods
(e.g. __eq__(), __lt__(), __add__(), __rsub__(), etc.) to indicate
that the operation is not implemented with respect to the other type;
may be returned by the in-place binary special methods (e.g. __imul__(),
__iand__(), etc.) for the same purpose. Its truth value is true."
Some people however appear to abuse it to mean "no value" when None is
a legitimate value (don't do that).
|