summaryrefslogtreecommitdiff
path: root/py
AgeCommit message (Collapse)Author
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.
2015-05-05obj: Handle user instance hash based on Python adhoc rules.Paul Sokolovsky
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.
2015-05-05objsingleton: New home for Ellipsis and NotImplemented.Paul Sokolovsky
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.
2015-05-04modbuiltins: Add NotImplemented builtin constant.Paul Sokolovsky
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).
2015-05-04modstruct: Rename module to "ustruct", to allow full Python-level impl.Paul Sokolovsky
2015-05-04modstruct: Group module qstr's together.Paul Sokolovsky
2015-05-04py: Check that arg to object.__new__ is a user-defined type.Damien George
Addresses issue #1203.
2015-05-04modmachine: Add new module to access hardware, starting with physical memory.Paul Sokolovsky
Refactored from "stm" module, provides mem8, mem16, mem32 objects with array subscript syntax.
2015-04-29py/repl.c: Fix shadowing of local variable "i".Damien George
2015-04-29py, readline: Add tab autocompletion for REPL.Damien George
Can complete names in the global namespace, as well as a chain of attributes, eg pyb.Pin.board.<tab> will give a list of all board pins. Costs 700 bytes ROM on Thumb2 arch, but greatly increases usability of REPL prompt.
2015-04-29py: Fix attrtuple array length in print and creation.Damien George
2015-04-28py: Replace py-version.sh with makeversionhdr.py, written in Python.Damien George
Also rename py-version.h to mpversion.h for consistency with mpconfig.h.
2015-04-29py: In attrtuple use the correct length value and index for 'fields'.Daniel Campora
2015-04-25py: Fix handling of negative numbers in struct.pack of q/Q.Damien George
2015-04-26vm: On exiting except block, clear sys.exc_info() value.Paul Sokolovsky
This doesn't handle case fo enclosed except blocks, but once again, sys.exc_info() support is a workaround for software which uses it instead of properly catching exceptions via variable in except clause.
2015-04-25py: Implement power op for long-long implementation of bignum.Damien George
2015-04-25py: Support conversion of bignum to bytes.Damien George
This gets int.to_bytes working for bignum, and also struct.pack with 'q' and 'Q' args on 32-bit machines. Addresses issue #1155.
2015-04-25modsys: Add basic sys.exc_info() implementation.Paul Sokolovsky
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.
2015-04-25objfun: Fix to stackless mode after recent refactor.Paul Sokolovsky
2015-04-24py: Modify bytecode "with" behaviour so it doesn't use any heap.Damien George
Before this patch a "with" block needed to create a bound method object on the heap for the __exit__ call. Now it doesn't because we use load_method instead of load_attr, and save the method+self on the stack.
2015-04-23py: Add optional code to check bytes constructor values are in range.Damien George
Compiled in only if MICROPY_CPYTHON_COMPAT is set. Addresses issue #1093.
2015-04-22py/objint_mpz.c: Make int_from_uint actually return uint.Damien George