summaryrefslogtreecommitdiffstatshomepage
path: root/py
Commit message (Collapse)AuthorAge
* py/objtype: Replace non-ASCII single-quote char with ASCII version.Damien George2017-02-14
|
* py/emitbc: Produce correct line number info for large bytecode chunks.Damien George2017-02-10
| | | | | | | | | | | | | | | Previous to this patch, for large chunks of bytecode that originated from a single source-code line, the bytecode-line mapping would generate something like (for 42 bytecode bytes and 1 line): BC_SKIP=31 LINE_SKIP=1 BC_SKIP=11 LINE_SKIP=0 This would mean that any errors in the last 11 bytecode bytes would be reported on the following line. This patch fixes it to generate instead: BC_SKIP=31 LINE_SKIP=0 BC_SKIP=11 LINE_SKIP=1
* py/objtype: Implement __delattr__ and __setattr__.dmazzella2017-02-09
| | | | | | This patch implements support for class methods __delattr__ and __setattr__ for customising attribute access. It is controlled by the config option MICROPY_PY_DELATTR_SETATTR and is disabled by default.
* py/nlr: Fix execstack builds for ARM.Dave Hylands2017-02-08
| | | | | | | | | | It seems that the gcc toolchain on the RaspberryPi likes %progbits instead of @progbits. I verified that %progbits also works under x86, so this should fix #2848 and fix #2842 I verified that unix and mpy-cross both compile on my RaspberryPi and on my x64 machine.
* py/map: Change mp_uint_t to size_t where appropriate.Damien George2017-02-08
| | | | | | | | The internal map/set functions now use size_t exclusively for computing addresses. size_t is enough to reach all of available memory when computing addresses so is the right type to use. In particular, for nanbox builds it saves quite a bit of code size and RAM compared to the original use of mp_uint_t (which is 64-bits on nanbox builds).
* py/asmxtensa.h: Explicitly cast args to 32-bits so left-shift is legal.Damien George2017-02-08
| | | | | | | For archs that have 16-bit pointers, the asmxtensa.h file can give compiler warnings about left-shift being greater than the width of the type (due to the inline functions in this header file). Explicitly casting the constants to uint32_t stops these warnings.
* py/objcomplex: Fix typo in ternary expression.Damien George2017-02-04
| | | | | This typo actually did the correct thing, but it was very obscure (came about from think in terms of Python's "x if cond else y" expression).
* py/objstr: Convert some instances of mp_uint_t to size_t.Damien George2017-02-03
|
* py/mpconfig.h: Move PY_BUILTINS_POW3 config option to diff part of file.Damien George2017-02-03
| | | | | With so many config options it's good to (at least try to) keep them grouped into logical sections.
* py/objstr: Give correct behaviour when passing a dict to %-formatting.Damien George2017-02-03
| | | | | | This patch fixes two main things: - dicts can be printed directly using '%s' % dict - %-formatting should not crash when passed a non-dict to, eg, '%(foo)s'
* py: Added optimised support for 3-argument calls to builtin.pow()Nicko van Someren2017-02-02
| | | | | | Updated modbuiltin.c to add conditional support for 3-arg calls to pow() using MICROPY_PY_BUILTINS_POW3 config parameter. Added support in objint_mpz.c for for optimised implementation.
* py/objset: Fix inplace binary ops so frozensets are not modified.Damien George2017-02-03
|
* py/objcomplex: Correctly handle case of 0j to power of something.Damien George2017-02-03
| | | | | 0j to the power of negative now raises ZeroDivisionError, and 0j to the power of positive returns 0.
* py/objfloat: Raise ZeroDivisionError for 0 to negative power.Damien George2017-02-03
|
* py/objset: Make inplace binary operators actually modify the set.Damien George2017-02-02
|
* py/objstringio: Allow to specify initial capacity by passing numeric argument.Paul Sokolovsky2017-02-02
| | | | E.g. uio.BytesIO(100) will allocate buffer with 100 bytes of space.
* unix: Make stack be non-executableDave Hylands2017-02-01
| | | | This PR is to address issue #2812.
* extmod: Remove MICROPY_FSUSERMOUNT and related files.Damien George2017-01-30
| | | | Replaced by MICROPY_VFS and the VFS sub-system.
* extmod/vfs_fat: Remove MICROPY_READER_FATFS component.Damien George2017-01-30
|
* extmod/machine_signal: Implement "signal" abstraction for machine module.Paul Sokolovsky2017-01-29
| | | | | | | | | | | A signal is like a pin, but ca also be inverted (active low). As such, it abstracts properties of various physical devices, like LEDs, buttons, relays, buzzers, etc. To instantiate a Signal: pin = machine.Pin(...) signal = machine.Signal(pin, inverted=True) signal has the same .value() and __call__() methods as a pin.
* extmod/vfs: Expose mp_vfs_mount_t type.Damien George2017-01-27
| | | | | It should only be used for low-level things and with caution, for example putting mounted VFS data in ROM or the static data section.
* extmod: Add generic VFS sub-system.Damien George2017-01-27
| | | | | | | | | | | | This provides mp_vfs_XXX functions (eg mount, open, listdir) which are agnostic to the underlying filesystem type, and just require an object with the relevant filesystem-like methods (eg .mount, .open, .listidr) which can then be mounted. These mp_vfs_XXX functions would typically be used by a port to implement the "uos" module, and mp_vfs_open would be the builtin open function. This feature is controlled by MICROPY_VFS, disabled by default.
* py/py.mk: Add CFLAGS_MOD flag to set config file for FatFs.Damien George2017-01-27
|
* py/showbc: Make sure to set the const_table before printing bytecode.Damien George2017-01-27
|
* py/objstr: Optimize string concatenation with empty string.Paul Sokolovsky2017-01-27
| | | | | | | | | | | | | | In this, don't allocate copy, just return non-empty string. This helps with a standard pattern of buffering data in case of short reads: buf = b"" while ...: s = f.read(...) buf += s ... For a typical case when single read returns all data needed, there won't be extra allocation. This optimization helps uasyncio.
* py/objmodule: Move module init/deinit code into runtime functions.Damien George2017-01-26
| | | | | | They are one-line functions and having them inline in mp_init/mp_deinit eliminates the overhead of a function call, and matches how other state is initialised in mp_init.
* py/objint: Fix left-shift overflow in checking for large int.Damien George2017-01-25
|
* py/builtinhelp: Implement help('modules') to list available modules.Damien George2017-01-22
| | | | | | | | This is how CPython does it, and it's very useful to help users discover the available modules for a given port, especially built-in and frozen modules. The function does not list modules that are in the filesystem because this would require a fair bit of work to do correctly, and is very port specific (depending on the filesystem).
* py: Move weak-link map to objmodule.c, and expose module maps as public.Damien George2017-01-22
|
* py: Add builtin help function to core, with default help msg.Damien George2017-01-22
| | | | | This builtin is configured using MICROPY_PY_BUILTINS_HELP, and is disabled by default.
* py/objint_longlong: Add stub for mp_obj_int_from_bytes_impl().Paul Sokolovsky2017-01-21
| | | | To be implemented later.
* py/objint: from_bytes(): Implement "byteorder" param and arbitrary precision.Paul Sokolovsky2017-01-21
| | | | | | | If result guaranteedly fits in a small int, it is handled in objint.c. Otherwise, it is delegated to mp_obj_int_from_bytes_impl(), which should be implemented by individual objint_*.c, similar to mp_obj_int_to_bytes_impl().
* py/mpz: Implement mpz_set_from_bytes() as a foundation for int.from_bytes().Paul Sokolovsky2017-01-21
|
* py/objint_mpz: Refactor switch-statement to remove unreachable default.Damien George2017-01-19
|
* py/formatfloat: Remove unreachable code.Damien George2017-01-19
| | | | | The if-block that this unreachable code is in has a condition "f>=5" so "fp_isless1(f)" will always fail.
* py/binary: mp_binary_get_size: Raise error on unsupported typecodes.Paul Sokolovsky2017-01-17
| | | | | Previouly, we had errors checked in callers, which led to duplicate code or missing checks in some places.
* py/runtime: Refactor default case of switch to remove assert(0).Damien George2017-01-17
|
* py/objexcept: Replace if-cond and assert(0) with simple assert.Damien George2017-01-17
|
* py/emitnative: Remove assert(0)'s or replace with mp_not_implemented.Damien George2017-01-17
|
* py/parse: Refactor code to remove assert(0)'s.Damien George2017-01-17
| | | | | This helps to improve code coverage. Note that most of the changes in this patch are just de-denting the cases of the switch statements.
* py/objgenerator: Don't raise RuntimeError if GeneratorExit ignored.Damien George2017-01-17
| | | | In this case it's allowed to be ignored.
* py/objgenerator: When throwing an object, don't make an exc instance.Damien George2017-01-17
| | | | Arguments to throw() for generators don't need to be exceptions.
* py/runtime: Fix handling of throw() when resuming generator.Damien George2017-01-17
| | | | | | If GeneratorExit is injected as a throw-value then that should lead to the close() method being called, if it exists. If close() does not exist then throw() should not be called, and this patch fixes this.
* py/runtime: Refactor assert(0) to improve coverage.Damien George2017-01-17
|
* py/builtinimport: Remove unreachable code and change obj-import comment.Damien George2017-01-16
|
* py/builtinimport: Raise ValueError for bad relative import, per CPython.Damien George2017-01-16
|
* py/builtinimport: Fix bug when importing names from frozen packages.Damien George2017-01-08
| | | | | | | | The commit d9047d3c8a99603884db25076c37778f50633ca6 introduced a bug whereby "from a.b import c" stopped working for frozen packages. This is because the path was not properly truncated and became "a//b". Such a path resolves correctly for a "real" filesystem, but not for a search in the list of frozen modules.
* py/mkrules.mk: Add MPY_CROSS_FLAGS option to pass flags to mpy-cross.Damien George2017-01-05
| | | | So that ports can pass their own custom options to mpy-cross.
* py/asmarm: Fix assembler's PASS_EMIT constant name.Damien George2017-01-03
|
* py/unicode: Comment-out unused function unichar_isprint.Damien George2016-12-28
|