| Commit message (Collapse) | Author | Age |
|
|
|
|
|
| |
Note that even though wrapped in MICROPY_CPYTHON_COMPAT, it is not
fully compatible because the modifications to the dictionary do not
propagate to the actual instance members.
|
|
|
|
| |
To comply with already established scheme for extmod's.
|
|
|
|
| |
Otherwise build fails if uctypes is disabled.
|
| |
|
|
|
|
|
|
|
|
| |
To let unix port implement "machine" functionality on Python level, and
keep consistent naming in other ports (baremetal ports will use magic
module "symlinking" to still load it on "import machine").
Fixes #1701.
|
| |
|
| |
|
|
|
|
|
| |
This for example will allow people to reload modules which didn't load
successfully (e.g. due to syntax error).
|
|
|
|
|
|
| |
Will be included only when MICROPY_PY_MATH_SPECIAL_FUNCTIONS is enabled.
Also covers cmath module (but only log10 is there at the moment).
|
|
|
|
|
| |
Based on the original patch by Galen Hazelwood:
https://github.com/micropython/micropython/pull/1517 .
|
|
|
|
| |
Only available when MICROPY_CAN_OVERRIDE_BUILTINS is enabled.
|
| |
|
| |
|
| |
|
|
|
|
| |
Saves 320 bytes on x86.
|
| |
|
|
|
|
|
|
|
| |
This patch makes configurable, via MICROPY_QSTR_BYTES_IN_HASH, the
number of bytes used for a qstr hash. It was originally fixed at 2
bytes, and now defaults to 2 bytes. Setting it to 1 byte will save
ROM and RAM at a small expense of hash collisions.
|
| |
|
|
|
|
|
|
|
| |
The TimeoutError is useful for some modules, specially the the
socket module. TimeoutError can then be alised to socket.timeout
and then Python code can differentiate between socket.error and
socket.timeout.
|
|
|
|
| |
It's configurable and only enabled for stmhal port.
|
| |
|
|
|
|
| |
This also pulls out hex_digit from py/lexer.c and makes unichar_hex_digit
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
| |
|
| |
|
|
|
|
|
| |
Refactored from "stm" module, provides mem8, mem16, mem32 objects with
array subscript syntax.
|
|
|
|
|
|
| |
The implementation is very basic and non-compliant and provided solely for
CPython compatibility. The function itself is bad Python2 heritage, its
usage is discouraged.
|
|
|
|
| |
Uses attrtuple if it's enabled, otherwise just a normal tuple.
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a long standing problem that viper code generation gave
terrible error messages, and actually no errors on pyboard where
assertions are disabled.
Now all compile-time errors are raised as proper Python exceptions, and
are of type ViperTypeError.
Addresses issue #940.
|
|
|
|
|
| |
Without this patch deleting a property, or class with descriptor, will
call the setter with a NULL value and lead to a crash.
|
|
|
|
|
|
|
|
|
| |
splitlines() occurs ~179 times in CPython3 standard library, so was
deemed worthy to implement. The method has subtle semantic differences
from just .split("\n"). It is also defined as working for any end-of-line
combination, but this is currently not implemented - it works only with
LF line-endings (which should be OK for text strings on any platforms,
but not OK for bytes).
|
|
|
|
| |
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.
|
| |
|