summaryrefslogtreecommitdiff
path: root/py
AgeCommit message (Collapse)Author
2015-06-25py: Remove mp_load_const_str and replace uses with inlined version.Damien George
2015-06-23py: Clarify comment in parsenum.c about ValueError vs SyntaxError.Damien George
2015-06-23py: Change exception type to ValueError when error reporting is terse.Daniel Campora
Addresses issue #1347
2015-06-22py: Cast argument for printf to int, to be compatible with more ports.Damien George
This allows stmhal to be compiled with MICROPY_DEBUG_PRINTERS.
2015-06-20py: Use a wrapper to explicitly check self argument of builtin methods.Damien George
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.
2015-06-18py: Make showbc decode UNPACK_EX, and use correct range for unop/binop.Damien George
2015-06-13py: Implement divmod for mpz bignum.Damien George
2015-06-13py: Add MP_BINARY_OP_DIVMOD to simplify and consolidate divmod builtin.Damien George
2015-06-13py: Implement second arg for math.log (optional value for base).Damien George
2015-06-11py: Rebuild port if mpconfigport.mk changed (if any).Paul Sokolovsky
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.
2015-06-09py: Support unicode (utf-8 encoded) identifiers in Python source.Damien George
Enabled simply by making the identifier lexing code 8-bit clean.
2015-06-08py: Fallback to stack alloca for Python-stack if heap alloc fails.Damien George
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.
2015-06-06unix: Make micropython -m <module> work for frozen modules.Paul Sokolovsky
This requires some special handling, which was previosuly applied only to the main code path.
2015-06-05py: Expose KeyboardInterrupt in builtins module.Damien George
2015-06-04unix: Allow to cat a script into stdin from the command line.Damien George
See issue #1306.
2015-06-04py: Implement native multiply operation in viper emitter.Damien George
2015-06-04py: Implement implicit cast to obj for viper load/store index/value.Damien George
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.
2015-06-03py: Add stack check to mp_iternext, since it can be called recursively.Damien George
Eg, builtin map can map over a map, etc, and call iternext deeply. Addresses issue #1294.
2015-05-31frozenmod: Include header with function prototypes.Paul Sokolovsky
2015-05-30py: Wrap qstr defs in quotes to protect from C preprocessor.Damien George
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.
2015-05-30py/parsenum.c: Rename "raise" func to "raise_exc" to avoid name clash.Damien George
"raise" is a common word that was found to exist in a vendor's stdlib.
2015-05-30py: Add further autodetection of endianess in mpconfig.h.Damien George
This patch was needed for gcc 4.4.
2015-05-30py: Get makeqstrdata.py and makeversionhdr.py running under Python 2.6.Damien George
These scripts should run under as wide a range of Python versions as possible.
2015-05-28py: Remove unnecessary extra handling of padding of nan/inf.Damien George
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.
2015-05-28py: Reduce size of mp_printf by eliminating unnecessary code.Damien George
Saves around 120 bytes on Thumb2 archs.
2015-05-25py: Make makeversionhdr.py extract version from docs/conf.py if no git.Damien George
Addresses issue #1285.
2015-05-24stmhal: Implement sys.std{in,out,err}.buffer, for raw byte mode.Damien George
It's configurable and only enabled for stmhal port.
2015-05-21py: Remove hexdigest QSTR since the method has been removed as well.Daniel Campora
2015-05-20py: Minor improvement to unichar_isxdigitDave Hylands
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.
2015-05-20extmod: Add ubinascii.unhexlifyDave Hylands
This also pulls out hex_digit from py/lexer.c and makes unichar_hex_digit
2015-05-17py: Implement mp_format_float for doubles and use where appropriatestijn
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.
2015-05-17py/binary: Make return type of mp_binary_get_size size_t instead of int.Kaspar Schleiser
Fixes sign-compare warning.
2015-05-17py/objobject: Don't make locals_dict if there's nothing to go in it.Kaspar Schleiser
2015-05-17py: Change _mp_obj_fun_builtin_t.fun to function pointer.Kaspar Schleiser
ISO C forbids conversion between function pointers and void*, gcc -pedantic triggers a warning.
2015-05-17py: Clean up declarations of str type/funcs that are also in unicode.Damien George
Background: trying to make an amalgamation of all the code gave some errors with redefined types and inconsistent use of static.
2015-05-13py: Fix printing of complex number when imaginary part is nanstijn
2015-05-12py: Add mp_obj_get_int_truncated and use it where appropriate.Damien George
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.
2015-05-12py: Convert hash API to use MP_UNARY_OP_HASH instead of ad-hoc function.Damien George
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__".
2015-05-11vm: Properly handle StopIteration raised in user instance iterator.Paul Sokolovsky
I.e. in bytecode Python functions.
2015-05-11objgenerator: Can optimize StopIteration to STOP_ITERATION only if arg is None.Paul Sokolovsky
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.
2015-05-11objgenerator: If generator yielded STOP_ITERATION value, it's stopped.Paul Sokolovsky
MP_OBJ_STOP_ITERATION is equivalent of raising StopIteration, except mp_vm_return_kind_t for it is "yield".
2015-05-10vm: Null pointer test when checking for StopIteration optimizations.Paul Sokolovsky
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.
2015-05-10runtime: Add TODO for mp_resume() on handling .close().Paul Sokolovsky
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.
2015-05-10py: iternext() may not return MP_OBJ_NULL, only MP_OBJ_STOP_ITERATION.Paul Sokolovsky
Testing for incorrect value led to premature termination of generator containing yield from for such iterator (e.g. "yield from [1, 2]").
2015-05-08emitnative: Revamp ARM codegen compile after full-arg support refactors.Paul Sokolovsky
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.
2015-05-06unix-cpy: Fix adjustment of stack size when leaving exception handler.Damien George
Also remove __debug__ from one of the bytecode tests.
2015-05-06py: Fix naming of function arguments when function is a closure.Damien George
Addresses issue #1226.
2015-05-06mkrules.mk: Add comment why dependency parsing regex was tweaked.Paul Sokolovsky
(Windows compatibility.)
2015-05-06Adjust sed regex that processes dependency file from compilerAri Suutari
so that resulting file is correct also on windows systems (ie. with file names containing drive letter).
2015-05-05py: Remove LOAD_CONST_ELLIPSIS bytecode, use LOAD_CONST_OBJ instead.Damien George
Ellipsis constant is rarely used so no point having an extra bytecode for it.