summaryrefslogtreecommitdiff
path: root/py
AgeCommit message (Collapse)Author
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
2015-04-22py/mpz.c: Fix bug with shl not truncating zero digits correctly.Damien George
2015-04-22py/emitnative.c: Fix stack adjustment when erroring on binary op.Damien George
2015-04-22py: Fix printing of "inf" and "nan" floating point values.Damien George
2015-04-21py: Clean up some bits and pieces in parser, grammar.Damien George
2015-04-21py: Simplify grammar for stmt rule (this is also how CPython has it).Damien George
2015-04-21stmhal: Implement os.uname() to get details of OS and hardware.Damien George
2015-04-21py: Add sys.implementation, containing uPy name and version number.Damien George
Uses attrtuple if it's enabled, otherwise just a normal tuple.
2015-04-21py: Add attrtuple object, for space-efficient tuples with attr access.Damien George
If you need the functionality of a namedtuple but will only make 1 or a few instances, then use an attrtuple instead.
2015-04-20py: Make viper codegen raise proper exception (ViperTypeError) on error.Damien George
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.
2015-04-19py/inlinethumb: Support for core floating point instructions.=
Adds support for the following Thumb2 VFP instructions, via the option MICROPY_EMIT_INLINE_THUMB_FLOAT: vcmp vsqrt vneg vcvt_f32_to_s32 vcvt_s32_to_f32 vmrs vmov vldr vstr vadd vsub vmul vdiv
2015-04-19py: Fix builtin ord so that it can handle bytes values >= 0x80.Damien George
Addresses issue #1188.
2015-04-18py/vstr.c: Allow vstr_printf to print correctly to a fixed buffer.Damien George
This patch allows vstr_printf to use all the available space of a fixed vstr buffer. vstr_printf is a good alternative to snprintf.
2015-04-16py: Add %q format support to mp_[v]printf, and use it.Damien George
2015-04-16py: Convert occurrences of non-debug printf to mp_printf.Damien George
2015-04-16py: Make mp_sys_stdout_print object, wrapping sys.stdout for mp_print*.Damien George
So now all printing should go via either mp_plat_print or mp_sys_stdout_print.
2015-04-16py: Overhaul and simplify printf/pfenv mechanism.Damien George
Previous to this patch the printing mechanism was a bit of a tangled mess. This patch attempts to consolidate printing into one interface. All (non-debug) printing now uses the mp_print* family of functions, mainly mp_printf. All these functions take an mp_print_t structure as their first argument, and this structure defines the printing backend through the "print_strn" function of said structure. Printing from the uPy core can reach the platform-defined print code via two paths: either through mp_sys_stdout_obj (defined pert port) in conjunction with mp_stream_write; or through the mp_plat_print structure which uses the MP_PLAT_PRINT_STRN macro to define how string are printed on the platform. The former is only used when MICROPY_PY_IO is defined. With this new scheme printing is generally more efficient (less layers to go through, less arguments to pass), and, given an mp_print_t* structure, one can call mp_print_str for efficiency instead of mp_printf("%s", ...). Code size is also reduced by around 200 bytes on Thumb2 archs.
2015-04-16objarray: Support assignment of bytes to bytearray slice.Paul Sokolovsky
2015-04-12py/formatfloat.c: Fix format of floating point numbers near 1.0.Dave Hylands
In particular, numbers which are less than 1.0 but which round up to 1.0. This also makes those numbers which round up to 1.0 to print with e+00 rather than e-00 for those formats which print exponents. Addresses issue #1178.
2015-04-12objstr: split(None): Fix whitespace properly.Paul Sokolovsky
2015-04-11py: In emitinlinethumb, use qstr_data instead of qstr_str and strlen.Damien George
2015-04-11py: Remove old debugging printf's in compile.c.Damien George
2015-04-11py: Combine load_attr and store_attr type methods into one (attr).Damien George
This simplifies the API for objects and reduces code size (by around 400 bytes on Thumb2, and around 2k on x86). Performance impact was measured with Pystone score, but change was barely noticeable.
2015-04-09py: Provide typedefs for function types instead of writing them inline.Damien George
2015-04-09py: Adjust some spaces in code style/format, purely for consistency.Damien George
2015-04-09py: Use a dummy type for referring to extern structsstijn
Fixes msvc linker warnings about mismatching sizes between the mp_obj_fdfile_t struct defined in file.c and the mp_uint_t declarations found in modsys.c and modbuiltins.c
2015-04-09py: Fix msvc warning '*/ found outside of comment'stijn
Also prevents some of the weaker syntax parsers out there treating the whole '*/*const*/' part as a comment
2015-04-07py: Implement full func arg passing for native emitter.Damien George
This patch gets full function argument passing working with native emitter. Includes named args, keyword args, default args, var args and var keyword args. Fully Python compliant. It reuses the bytecode mp_setup_code_state function to do all the hard work. This function is slightly adjusted to accommodate native calls, and the native emitter is forced a bit to emit similar prelude and code-info as bytecode.
2015-04-07py: Simplify bytecode prelude when encoding closed over variables.Damien George
2015-04-06py: Implement calling functions with *args in native emitter.Damien George