Damien George
7ef75f9f75
py/objstr: Fix error type for badly formatted format specifier.
Was KeyError, should be ValueError.
9 years ago
Damien George
1d350b8ac6
tests: Add a few tests for bool, bytearray, float to improve coverage.
9 years ago
Paul Sokolovsky
58d9b10d70
tests: Split byteorder-dependent tests to *_endian.py's.
9 years ago
Paul Sokolovsky
a160b70ced
tests: Add test on set/frozenset equality.
9 years ago
Paul Sokolovsky
8b3b2d04a8
objset: frozensets are hashable.
9 years ago
Damien George
d007cb8903
tests: Add more tests to improve coverage, mostly testing exceptions.
9 years ago
Damien George
9a2913ed1c
py/objlist: Make list += accept all arguments and add test.
9 years ago
Damien George
3900fed849
tests: Skip parser test if "compile" builtin is not available.
9 years ago
Damien George
96f0dd3cbc
py/parse: Fix handling of empty input so it raises an exception.
9 years ago
Damien George
d241c2a592
py/lexer: Raise SyntaxError when str hex escape sequence is malformed.
Addresses issue #1390 .
9 years ago
Delio Brignoli
32aba40830
py: Implement memoryview slice assignment.
Adds ability to do "memcpy" with memoryview objects, such as:
m1[0:3] = m2[2:5].
10 years ago
Sebastian Plamauer
1e8ca3a3cf
modbuiltins: Implement round() to precision.
9 years ago
Daniel Campora
d709622bd2
tests: Adapt basics/memoryerror.py for ports with lower heap sizes.
10 years ago
Damien George
06593fb0f2
py: Use a wrapper to explicitly check self argument of builtin methods.
Previous to this patch a call such as list.append(1, 2) would lead to a
seg fault. This is because list.append is a builtin method and the first
argument to such methods is always assumed to have the correct type.
Now, when a builtin method is extracted like this it is wrapped in a
checker object which checks the the type of the first argument before
calling the builtin function.
This feature is contrelled by MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG and
is enabled by default.
See issue #1216 .
10 years ago
Damien George
e9ce00d874
py: Implement divmod for mpz bignum.
10 years ago
Damien George
7bab32ef89
tests: Add further tests for class defining __hash__.
10 years ago
Damien George
c2a4e4effc
py: Convert hash API to use MP_UNARY_OP_HASH instead of ad-hoc function.
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__".
10 years ago
Paul Sokolovsky
6738c1dded
vm: Properly handle StopIteration raised in user instance iterator.
I.e. in bytecode Python functions.
10 years ago
Paul Sokolovsky
4ed7b7f751
py: iternext() may not return MP_OBJ_NULL, only MP_OBJ_STOP_ITERATION.
Testing for incorrect value led to premature termination of generator
containing yield from for such iterator (e.g. "yield from [1, 2]").
10 years ago
Damien George
9a42eb541e
py: Fix naming of function arguments when function is a closure.
Addresses issue #1226 .
10 years ago
Paul Sokolovsky
37c6555b44
obj: Handle user instance hash based on Python adhoc rules.
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.
10 years ago
Paul Sokolovsky
3d3ef36e97
modstruct: Rename module to "ustruct", to allow full Python-level impl.
10 years ago
Damien George
47b9809d23
py: Check that arg to object.__new__ is a user-defined type.
Addresses issue #1203 .
10 years ago
Damien George
271d18eb08
py: Support conversion of bignum to bytes.
This gets int.to_bytes working for bignum, and also struct.pack with 'q'
and 'Q' args on 32-bit machines.
Addresses issue #1155 .
10 years ago
Damien George
1f9e2188a6
tests: Add tests for attrtuple, and for more corner cases.
10 years ago
Damien George
d8cbbcaa9d
py: Fix builtin ord so that it can handle bytes values >= 0x80.
Addresses issue #1188 .
10 years ago
Damien George
90aa7595b4
tests: Convert line endings in fun_name.py from CRLF to LF.
10 years ago
Paul Sokolovsky
56beb01724
objarray: Support assignment of bytes to bytearray slice.
10 years ago
Paul Sokolovsky
8b7faa31e1
objstr: split(None): Fix whitespace properly.
10 years ago
Damien George
e5c4362a98
tests: Add some more tests to improve code coverage of corner cases.
10 years ago
Damien George
97abe22963
tests: Add tests to exercise lexer; and some more complex number tests.
10 years ago
Damien George
9dd3640464
tests: Add missing tests for builtins, and many other things.
10 years ago
Paul Sokolovsky
620058cc57
tests: Add test for str.splitlines().
10 years ago
Paul Sokolovsky
ad038ca101
tests/class_descriptor.py: Fix line-endings (were CRLF).
10 years ago
stijn
28fa84b445
py: Add optional support for descriptors' __get__ and __set__ methods.
Disabled by default. Enabled on unix and windows ports.
10 years ago
Damien George
23d7fd526d
tests: Skip some new tests when testing native emitter.
10 years ago
Damien George
214179b430
tests: Add tests for SyntaxError, TypeError, and other missing things.
This is intended to improve coverage of the test suite.
10 years ago
stijn
3cc17c69ff
py: Allow retrieving a function's __name__.
Disabled by default. Enabled on unix and stmhal ports.
10 years ago
Paul Sokolovsky
d48035b06b
tests: Add basic test for OrderedDict.
Mostly to have coverage of newly added code in map.c.
10 years ago
Damien George
6837d46c1d
py: Fix builtin abs so it works for bools and bignum.
10 years ago
Damien George
26a9975fba
tests: Add some more tests for bytes, bignum, string and ujson.
10 years ago
Damien George
af43565322
tests: Add tests for things that are not already tested.
The aim here is to improve coverage of the code.
10 years ago
Peter D. Gray
b2a237d337
py: Add support for start/stop/step attributes of builtin range object.
10 years ago
Damien George
086a7616dd
tests: Add tests for boundmeth; and bignum cmp, unary, float, error.
10 years ago
Damien George
f2a889564b
tests: Add basics test for gc module.
10 years ago
Damien George
fe3da09fa0
tests: Use range as iterable instead of list comprehension.
So that navite emitter passes (comprehensions use yield which is not yet
supported by native emitter).
10 years ago
Damien George
24ffb8e876
tests: Add tests for builtins: all, any, sum, abs.
10 years ago
Damien George
2af921fb51
tests: Add tests for op special meths, ubinascii, complex.
10 years ago
Paul Sokolovsky
992284be39
tests: Add test for array slice assignment.
10 years ago
Damien George
ed8b4da0db
tests: Remove obsolete test; don't use fp in micropython/ tests.
10 years ago