summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics
Commit message (Collapse)AuthorAge
* py: Reluctantly add an extra pass to bytecode compiler.Damien George2015-01-14
| | | | | | | | | | | | | | | Bytecode also needs a pass to compute the stack size. This is because the state size of the bytecode function is encoded as a variable uint, so we must know the value of this uint before we encode it (otherwise the size of the generated code changes from one pass to the next). Having an entire pass for this seems wasteful (in time). Alternative is to allocate fixed space for the state size (would need 3-4 bytes to be general, when 1 byte is usually sufficient) which uses a bit of extra RAM per bytecode function, and makes the code less elegant in places where this uint is encoded/decoded. So, for now, opt for an extra pass.
* py: Never intern data of large string/bytes object; add relevant tests.Damien George2015-01-13
| | | | | | | | | | Previously to this patch all constant string/bytes objects were interned by the compiler, and this lead to crashes when the qstr was too long (noticeable now that qstr length storage defaults to 1 byte). With this patch, long string/bytes objects are never interned, and are referenced directly as constant objects within generated code using load_const_obj.
* py: Implement fallback for equality check for all types.Damien George2015-01-11
| | | | | Return "not equal" for objects that don't implement equality check. This is as per Python specs.
* tests: Add test for when instance member overrides class member.Damien George2015-01-08
|
* tests: Separate out test cases that rely on float support to float/ dir.Damien George2015-01-08
|
* objarray: Make sure that longint works as bytearray size.Paul Sokolovsky2015-01-04
|
* objstr: Implement kwargs support for str.format().Paul Sokolovsky2015-01-04
|
* py: Allow keyword arguments for namedtuplestijn2015-01-01
|
* py: Use sequence of strings for named tuple initializationstijn2015-01-01
| | | | | | - remove single string initialization style - take list of strings instead - store list in the type for fast lookup
* py: Fix rshift and not of zero/one edge cases in mpz.Damien George2014-12-31
| | | | Addresses issue #1027.
* py: Make bytes objs work with more str methods; add tests.Damien George2014-12-24
|
* py: Fix optimised for-loop compiler so it follows proper semantics.Damien George2014-12-12
| | | | | | | | | You can now assign to the range end variable and the for-loop still works correctly. This fully addresses issue #565. Also fixed a bug with the stack not being fully popped when breaking out of an optimised for-loop (and it's actually impossible to write a test for this case!).
* tests: Add test for semantics of for-loop that optimisation can break.Damien George2014-12-11
|
* py: Allow builtins to be overridden.Damien George2014-12-09
| | | | | | | | | | | | | | This patch adds a configuration option (MICROPY_CAN_OVERRIDE_BUILTINS) which, when enabled, allows to override all names within the builtins module. A builtins override dict is created the first time the user assigns to a name in the builtins model, and then that dict is searched first on subsequent lookups. Note that this implementation doesn't allow deleting of names. This patch also does some refactoring of builtins code, creating the modbuiltins.c file. Addresses issue #959.
* py: Rename mp_obj_int_get to mp_obj_int_get_truncated; fix struct.pack.Damien George2014-12-05
| | | | | | | | | | | mp_obj_int_get_truncated is used as a "fast path" int accessor that doesn't check for overflow and returns the int truncated to the machine word size, ie mp_int_t. Use mp_obj_int_get_truncated to fix struct.pack when packing maximum word sized values. Addresses issues #779 and #998.
* py: Allow bytes/bytearray/array to be init'd by buffer protocol objects.Damien George2014-12-04
| | | | | | | Behaviour of array initialisation is subtly different for bytes, bytearray and array.array when argument has buffer protocol. This patch gets us CPython conformant (except we allow initialisation of array.array by buffer with length not a multiple of typecode).
* py: Implement +, += and .extend for bytearray and array objs.Damien George2014-11-30
| | | | Addresses issue #994.
* tests: Split out float test from builtin_round.py.Damien George2014-11-29
|
* tests: Add test for hash of user defined class.Damien George2014-11-15
|
* py: Allow +, in, and compare ops between bytes and bytearray/array.Damien George2014-11-05
| | | | | | Eg b"123" + bytearray(2) now works. This patch actually decreases code size while adding functionality: 32-bit unix down by 128 bytes, stmhal down by 84 bytes.
* py: Fix builtin callable so it checks user-defined instances correctly.Damien George2014-11-03
| | | | Addresses issue #953.
* py: Fix bug with right-shifting small ints by large amounts.Paul Sokolovsky2014-11-02
| | | | Undefined behavior in C, needs explicit check.
* py: Add builtin round function.Damien George2014-10-31
| | | | Addresses issue #934.
* objstr: Allow to convert any buffer proto object to str.Paul Sokolovsky2014-10-31
| | | | | Original motivation is to support converting bytearrays, but easier to just support buffer protocol at all.
* tests: Get builtin_compile to skin properly on pyboard.Damien George2014-10-26
|
* py: Fix memoryview referencing so it retains ptr to original buffer.Damien George2014-10-26
| | | | | This way, if original parent object is GC'd, the memoryview still points to the underlying buffer data so that buffer is not GC'd.
* tests: Add test for compile builtin.Damien George2014-10-25
|
* py: Add builtin memoryview object (mostly using array code).Damien George2014-10-23
|
* py: Fix smallint modulo with negative arguments.Damien George2014-10-22
| | | | Addresses issue #927.
* py: Remove unused and unneeded SystemError exception.Damien George2014-10-22
| | | | | It's purpose is for internal errors that are not catastrophic (ie not as bad as RuntimeError). Since we don't use it, we don't need it.
* py: Add more compiler optimisations for constant if/while conditions.Damien George2014-10-17
|
* tests: Add test for nested while with exc and break.Damien George2014-10-17
|
* objclosure: Fix printing of generator closures.Paul Sokolovsky2014-10-16
| | | | The code previously assumed that only functions can be closed over.
* py: Make compiler return a proper exception on SyntaxError.Damien George2014-10-05
|
* py: Remove IOError since it's deprecated; use OSError instead.Damien George2014-09-30
| | | | | | | | | | | In CPython IOError (and EnvironmentError) is deprecated and aliased to OSError. All modules that used to raise IOError now raise OSError (or a derived exception). In Micro Python we never used IOError (except 1 place, incorrectly) and so don't need to keep it. See http://legacy.python.org/dev/peps/pep-3151/ for background.
* tests: Add test for exception matching of a tuple of exceptions.Damien George2014-09-25
|
* py: Make native emitter handle multi-compare and not/is not/not in ops.Damien George2014-09-23
|
* tests: Fix uctypes tests to run on 64bit arch; enable more native tests.Damien George2014-09-23
|
* py: Make mpz able to use 16 bits per digit; and 32 on 64-bit arch.Damien George2014-09-06
| | | | | | | | | | | | | | | | Previously, mpz was restricted to using at most 15 bits in each digit, where a digit was a uint16_t. With this patch, mpz can use all 16 bits in the uint16_t (improvement to mpn_div was required). This gives small inprovements in speed and RAM usage. It also yields savings in ROM code size because all of the digit masking operations become no-ops. Also, mpz can now use a uint32_t as the digit type, and hence use 32 bits per digit. This will give decent improvements in mpz speed on 64-bit machines. Test for big integer division added.
* py: Fix 2 bugs in native emitter: jump_or_pop and stack settling.Damien George2014-08-29
| | | | Addresses issue #838.
* Make int(b'123') work properly.Dave Hylands2014-08-26
|
* py: Add dispatch for user defined ==, >, <=, >=.Damien George2014-08-26
| | | | Addresses issue #827.
* py: Consolidate min/max functions into one, and add key= argument.Damien George2014-08-24
| | | | Addresses issue #811.
* py: Fix mult by negative number of tuple, list, str, bytes.Damien George2014-08-13
| | | | | | | Multiplication of a tuple, list, str or bytes now yields an empty sequence (instead of crashing). Addresses issue #799 Also added ability to mult bytes on LHS by integer.
* py: Improve range: add len, subscr, proper print.Damien George2014-08-12
| | | | | | | | Can now index ranges with integers and slices, and reverse ranges (although reversing is not very efficient). Not sure how useful this stuff is, but gets us closer to having all of Python's builtins.
* py: Implement builtin reversed() function.Damien George2014-08-12
| | | | | | | | reversed function now implemented, and works for tuple, list, str, bytes and user objects with __len__ and __getitem__. Renamed mp_builtin_len to mp_obj_len to make it publically available (eg for reversed).
* objstr: Make sure that bytes are indexed as bytes, not as unicode.Paul Sokolovsky2014-08-11
| | | | Fixes #795.
* objarray: Implement equality testing between arrays and other buffers.Paul Sokolovsky2014-08-10
|
* tests: Rename test scripts, changing - to _ for consistency.Damien George2014-07-05
| | | | | | From now on, all new tests must use underscore. Addresses issue #727.
* py: Automatically ake __new__ a staticmethod.Damien George2014-07-05
| | | | Addresses issue #622.