summaryrefslogtreecommitdiffstatshomepage
path: root/py
Commit message (Collapse)AuthorAge
* py/lexer: Properly classify floats that look like hex numbers.Damien George2015-09-07
| | | | Eg 0e0 almost looks like a hex number but in fact is a float.
* py/lexer: Raise SyntaxError when unicode char point out of range.Damien George2015-09-07
|
* py/lexer: Raise NotImplError for unicode name escape, instead of assert.Damien George2015-09-07
|
* py/compile: Refine SyntaxError for repeated use of global/nonlocal.Damien George2015-09-07
|
* py: Eliminate some cases which trigger unused parameter warnings.Damien George2015-09-04
|
* py/objstr: Check for keyword args before checking for no posn args.Damien George2015-09-04
| | | | Otherwise something like bytes(abc=123) will succeed.
* py/objstr: For str.endswith(s, start) raise NotImpl instead of assert.Damien George2015-09-04
|
* py/objbool: Simplify dispatch of bool binary op.Damien George2015-09-04
| | | | | | This optimises (in speed and code size) for the common case where the binary op for the bool object is supported. Unsupported binary ops still behave the same.
* py/compile: Only compile function annotations if really needed.Damien George2015-09-04
| | | | | | Function annotations are only needed when the native emitter is enabled and when the current scope is emitted in viper mode. All other times the annotations can be skipped completely.
* stmhal: add option to query for the current usb modeTony Abboud2015-09-03
| | | | | | Fetch the current usb mode and return a string representation when pyb.usb_mode() is called with no args. The possible string values are interned as qstr's. None will be returned if an incorrect mode is set.
* py: Use mp_not_implemented consistently for not implemented features.Damien George2015-09-03
|
* py/objstr: Simplify printing of bytes objects when unicode enabled.Damien George2015-09-03
|
* py: Inline single use of mp_obj_str_get_len in mp_obj_len_maybe.Damien George2015-09-03
| | | | | | Gets rid of redundant double check for string type. Also remove obsolete declaration of mp_obj_str_get_hash.
* py: Make "enumerate" qstr be conditional on MICROPY_PY_BUILTINS_ENUMERATE.Paul Sokolovsky2015-09-03
|
* py/binary: Add support for array('q') and array('Q').Damien George2015-09-01
|
* py/objstr: Make str.rsplit(None,n) raise NotImpl instead of assert(0).Damien George2015-09-01
|
* vm: Handle "raise X from Y" statements the best way we can.Paul Sokolovsky2015-09-01
| | | | | By issuing a warning that exception chaining is not supported, and ignoring "from Y" argument.
* modbuiltins: Consistently use indentation for #if.Paul Sokolovsky2015-08-31
|
* py/objstr: Simplify error handling for bad conversion specifier.Damien George2015-08-30
|
* py/objgetitemiter: Make it_iternext() recognize IndexError.Tom Soulanille2015-08-30
|
* py/objstr: Fix error reporting for unexpected end of modulo format str.Damien George2015-08-29
|
* py/objstr: Fix error type for badly formatted format specifier.Damien George2015-08-29
| | | | Was KeyError, should be ValueError.
* py/objstr: Make string formatting 8-bit clean.Damien George2015-08-29
|
* py: Treat -m32 flag as part of CC, LD, etc.Paul Sokolovsky2015-08-29
| | | | | | Indeed, this flag efectively selects architecture target, and must consistently apply to all compiles and links, including 3rd-party libraries, unlike CFLAGS, which have MicroPython-specific setting.
* objset: frozensets are hashable.Paul Sokolovsky2015-08-28
|
* py: Add MICROPY_PY_BUILTINS_FILTER, disable for minimal ports.Paul Sokolovsky2015-08-20
| | | | Saves 320 bytes on x86.
* py: Remove unused compile scope flags, and irrelevant flag compute code.Damien George2015-08-17
|
* unix-cpy: Remove unix-cpy. It's no longer needed.Damien George2015-08-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | unix-cpy was originally written to get semantic equivalent with CPython without writing functional tests. When writing the initial implementation of uPy it was a long way between lexer and functional tests, so the half-way test was to make sure that the bytecode was correct. The idea was that if the uPy bytecode matched CPython 1-1 then uPy would be proper Python if the bytecodes acted correctly. And having matching bytecode meant that it was less likely to miss some deep subtlety in the Python semantics that would require an architectural change later on. But that is all history and it no longer makes sense to retain the ability to output CPython bytecode, because: 1. It outputs CPython 3.3 compatible bytecode. CPython's bytecode changes from version to version, and seems to have changed quite a bit in 3.5. There's no point in changing the bytecode output to match CPython anymore. 2. uPy and CPy do different optimisations to the bytecode which makes it harder to match. 3. The bytecode tests are not run. They were never part of Travis and are not run locally anymore. 4. The EMIT_CPYTHON option needs a lot of extra source code which adds heaps of noise, especially in compile.c. 5. Now that there is an extensive test suite (which tests functionality) there is no need to match the bytecode. Some very subtle behaviour is tested with the test suite and passing these tests is a much better way to stay Python-language compliant, rather than trying to match CPy bytecode.
* py: Add stream_tell method, and use for unix and stmhal file tell.blmorris2015-08-13
|
* py: In native ARM emitter, load r7 with table earlier in func prelude.Damien George2015-08-12
| | | | | r7 may be needed to set up code state, so it must be loaded before the set-up function is called.
* py/makeversionhdr.py: Use returncode attr to be Python2.7 compat.Damien George2015-08-12
|
* py/makeversionhdr.py: Fallback to using docs version if no git repo.Damien George2015-08-11
| | | | Addresses issue #1420.
* py/objlist: Make list += accept all arguments and add test.Damien George2015-08-02
|
* makeqstrdata.py: Typo fix in comment.Paul Sokolovsky2015-07-31
|
* py/compile: Give more precise line number for compile errors.Damien George2015-07-29
| | | | | | | | | | | | | | Previous to this patch there were some cases where line numbers for errors were 0 (unknown). Now the compiler attempts to give a better line number where possible, in some cases giving the line number of the closest statement, and other cases the line number of the inner-most scope of the error (eg the line number of the start of the function). This helps to give good (and sometimes exact) line numbers for ViperTypeError exceptions. This patch also makes sure that the first compile error (eg SyntaxError) that is encountered is reported (previously it was the last one that was reported).
* py/repl: Don't look inside strings for unmatched brackets/quotes.Damien George2015-07-29
| | | | | | | When looking to see if the REPL input needs to be continued on the next line, don't look inside strings for unmatched ()[]{} ''' or """. Addresses issue #1387.
* py: For viper compile errors, add traceback with function and filename.Damien George2015-07-27
| | | | | | | | | ViperTypeError now includes filename and function name where the error occurred. The line number is the line number of the start of the function definition, which is the best that can be done without a lot more work. Partially addresses issue #1381.
* py: Disable REPL EMACS key bindings by default.Damien George2015-07-26
|
* lib/mp-readline: Add emacs-style control characters for cursor movement.Tom Soulanille2015-07-26
| | | | Disabled by default. Adds 108 bytes to Thumb2 arch when enabled.
* py/parse: Fix handling of empty input so it raises an exception.Damien George2015-07-24
|
* py/parse: De-duplicate and simplify code for parser "or" rule.Damien George2015-07-24
|
* py/lexer: Raise SyntaxError when str hex escape sequence is malformed.Damien George2015-07-23
| | | | Addresses issue #1390.
* py: Issue an error when compiling Viper functions with more than 4 args.Damien George2015-07-23
| | | | Otherwise it can be very hard to track down bugs.
* py: Allow viper functions to take up to 4 arguments.Damien George2015-07-23
| | | | Addresses issue #1380.
* py: reduce array slice assignment code sizeDelio Brignoli2015-06-06
|
* py: Small code space optimisations for memoryview slice assigment.Damien George2015-07-20
| | | | | Also adds #if guards to allow uPy core to compile without memoryview enabled, but with slice assignment enabled.
* py: Implement memoryview slice assignment.Delio Brignoli2015-07-20
| | | | | Adds ability to do "memcpy" with memoryview objects, such as: m1[0:3] = m2[2:5].
* py: Make qstr hash size configurable, defaults to 2 bytes.Damien George2015-07-20
| | | | | | | 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.
* modbuiltins: Implement round() to precision.Sebastian Plamauer2015-07-19
|
* py: Improve allocation policy of qstr data.Damien George2015-07-14
| | | | | | | | | | | | | | | | | | | | Previous to this patch all interned strings lived in their own malloc'd chunk. On average this wastes N/2 bytes per interned string, where N is the number-of-bytes for a quanta of the memory allocator (16 bytes on 32 bit archs). With this patch interned strings are concatenated into the same malloc'd chunk when possible. Such chunks are enlarged inplace when possible, and shrunk to fit when a new chunk is needed. RAM savings with this patch are highly varied, but should always show an improvement (unless only 3 or 4 strings are interned). New version typically uses about 70% of previous memory for the qstr data, and can lead to savings of around 10% of total memory footprint of a running script. Costs about 120 bytes code size on Thumb2 archs (depends on how many calls to gc_realloc are made).